RadhaKrishnaKiJaya
asked on
Modal dialog does not open on click of a button
Hi Experts,
I have a button on my form. When I click it, it supposed to popup a modal form. My problem is it pops up the modal form sometime but not all the time. I am using asp.net and c#. Any reason why it is happening. I have attached the code. When "#btnArchive" is clicked, it should popup the window all the time.
Thanks in advance.
Temp.txt
I have a button on my form. When I click it, it supposed to popup a modal form. My problem is it pops up the modal form sometime but not all the time. I am using asp.net and c#. Any reason why it is happening. I have attached the code. When "#btnArchive" is clicked, it should popup the window all the time.
Thanks in advance.
Temp.txt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot for all the replay. I tried the .on(), but it did not work. It is not creating content dynamically. For one shipping id when I click the button it pops up the window. But another shipping id when I click the 'Archive' button it does not pop up the window. In fact it does not go inside the 'click' event.
Thanks.
Thanks.
Please share the ASPX if you can. It will help us figure out what needs to be done. Also as Julian suggested did you try and check the console for any errors?
And if you are using Visual Studio - you can try to debug it will show you step by step how things are going, if you do not want to use the Visual Studio from Dev Toolbar itself you can debug the code but that might be bit difficult if you are new to script debugging.
And if you are using Visual Studio - you can try to debug it will show you step by step how things are going, if you do not want to use the Visual Studio from Dev Toolbar itself you can debug the code but that might be bit difficult if you are new to script debugging.
ASKER
Actually I have already share some ASPX code. For some ID it does not execute the click function at all. I am not sure what is blocking. Can you please tell me how to check console error? Because I pressed F12 but it did not show any error.
Thanks.
Thanks.
For one shipping id when I click the button it pops up the window. But another shipping id when I click the 'Archive' button it does not pop up the window. In fact it does not go inside the 'click' event
jQuery('body').on('click','#btnArchive', function () {
Your click handler is bound to an id, id's must be unique but in your comment you are saying "but another shipping id, when I click the button" - indicating you have more than one button - which means your click handler should not be bound to an id - it should be bound to a class or a selector that allows for more than one.
That code is not code. It is a snippet of code. I am thinking if there is anything else that can interfere with your code that is why I am asking for the entire ASPX.
Coming to the second question, when you run the code in browser, press F12 a window will appear. In that window there is a tab called Console. click on that and check if there are any messages/errors in that.
Coming to the second question, when you run the code in browser, press F12 a window will appear. In that window there is a tab called Console. click on that and check if there are any messages/errors in that.
ASKER
Thanks for your help. Actually "pnlArchiveAddressConfirmD ialog" was getting invisible depending on some condition. That is why click event was not working. But I really appriciate your thoughts and help.
Actually "pnlArchiveAddressConfirmDThis is way it is important to post as much code as is relevant - otherwise we can only guess at the problem.ialog" was getting invisible depending on some condition. That is why click event was not working
ASKER
I can understand what you are saying. But I have limitations what I can post . Also it has thousands of LOC. Thanks anyway
ASKER
Your F12 suggestion helped me to find the problem. Thanks.
Ok, glad you came right.
If that does not work then put a debugger; statement in your script block at the beginning and inside
Open in new window
so that we can figure out whether it is being called or not.