Whenever i add a ModalPopup into the page set the ok controlid, cancelcontrol id and target control id = hidden fieldId. Databind a Gridview to some data and add a button, link template field to the gridview which causes the ItemCommand event and click that button it would do nothing. Unless you open the modalPopup and close it again.
You can replicate the same using some sample data.
1.Add a Gridiview with Event driven control like linkbutton, Button etc that causes Postback, RowCommand event.
2.Add a modalPopup extender. Add a panel for it. Set the targetcontrolId of the extender to Hidden field on the page.
- Now try launching the application and Clicking the button that raises Rowcommand event. It would do nothing. I still don't understand 开发者_JS百科why this happens!!
This happens when the target control ID for the modal popup control is a hidden field. I replaced it with a Button controls and do make sure you hide it with css and add below code
<asp:Button runat="server" id="btnpoupTarget" style="display:none" usesubmitbehaviour="false" onclick="return false;"/>
the onclick is to avoid posting back if someone unhides the button by setting display css attribute and clicks it.
精彩评论