ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Popup Open fail from demo
Title:
B
I
{code}
?
I tried with various ways from demo code and all returned the same error: Cannot read properties of undefined (reading 'open') One of the sample is "Open without initialization" - https://demo.aspnetawesome.com/PopupDemo Below is the exact same code I used from the demo and returned the above the error. The version I used is the latest trail at 7.0.5 @Html.Awe().Button().Text("Open Popup").OnClick("openPopupAwe()") <script> function openPopupAwe() { awe.open("popupAwe", { setCont: function (sp, o) { //console.log(utils.getParams(sp)); var cont = $('<div style="padding: 0 3em;">Are you sure you want to perform this action?</div>'); o.scon.html(cont); }, btns: [ { text: 'Yes', ok: 1, // add okbtn class action: function () { $(this).data('api').close(); } }, { text: 'No', action: function () { $(this).data('api').close(); } }], height: 200, width: 700, title: 'please confirm', modal: true, //params: { p: 123 } //top: true, //close: function() { console.log('popup closed'); }, //url: '@Url.Action("Popup1")', // works if setCont and content not set //content: 'hello world' //outClickClose: true, //popupClass: 'class1', //fullscreen: true }); } </script>
Save Changes
Cancel
Roger Seto
asked at 02 Mar 2022
while viewing your app, in your browser console try running this code: awe.open('qwe', { setCont: function(sp, o){ o.scon.html('<b>hello world</b>'); } }) and see if it works also remove the `()` from `.OnClick("openPopupAwe()")`
at 02 Mar 2022
Omu
I found myself add a grand function in lower section of the code and manage to get the onclick going, but still no luck whenever I use the .open statement. The same error still here: Cannot read properties of undefined (reading 'open') Below is my update: <button class="awe-btn" id="btnOpenPopup">Open Popup</button> <script> $(function () { $('#btnOpenPopup').click(function () { awe.open("popupAwe", { setCont: function(sp, o){ o.scon.html('<b>hello world</b>'); } }); } });
at 02 Mar 2022
Roger Seto
is this code working in your browser console ? awe.open('qwe', { setCont: function(sp, o){ o.scon.html('<b>hello world</b>'); } })
at 02 Mar 2022
Omu
No. I tired with both ends on browser console and source. They all return with the same error.
at 02 Mar 2022
Roger Seto
make sure you've followed the installation steps correctly: https://www.aspnetawesome.com/learn/mvc/Installation the code above should work, you can try it on this page in the console
at 02 Mar 2022
Omu
was your problem solved ?
at 02 Mar 2022
Omu
Thanks for following up. I've checked thru the installation stack once again and they are identical but the error is still the same.
at 03 Mar 2022
Roger Seto
you can try this https://www.aspnetawesome.com/learn/mvc/CommonProblems#Isolate-the-problem and we'll be able to have a look
at 03 Mar 2022
Omu
Answers
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK