c# - How to use the .show() of Ajax ModalPopUpExtender when ModalPopupExtender is within a gridview? -


so using modalpopupextender control ajax control toolkit. it's understanding when want set targetcontrolid button that's within gridview, need put modalpopupextender within template holds button. in case:

<asp:templatefield>            <itemtemplate>                <asp:linkbutton id="lbtndeletewidget" runat="server" text="delete" commandname="deletewidget" commandargument="<%# container.dataitemindex %>"></asp:linkbutton>            </itemtemplate>            <footerstyle horizontalalign="right" />            <footertemplate>            <asp:button id="btnaddnewwidget" runat="server" cssclass="buttonstyle" text="add new widget" onclick="btnaddnewwidget_click"/>             <ajaxtoolkit:modalpopupextender id="modalpopupextender1" runat="server"            backgroundcssclass="modalbackground"            dropshadow="true"            okcontrolid="btnsavewidget"            cancelcontrolid="aclosex"            popupcontrolid="panel1"            targetcontrolid="btnaddnewwidget" />        </footertemplate> </asp:templatefield> 

now, working well, modal popup appears when button pressed , good. however, modalpopupextender has nasty habbit of closing modal on postback. pop contains dropdownlists have postbacks (it needs execute relevant code). whenever happens modal closes.

a(n ugly) work around using show() function. example, whenever dropdownlist postback, function ends modalpopupextender1.show();.

the problem:

modalpopupextender1 not exist in current context, because defined within template field, work. how fix this? wish refer modalpopupextender1 , use .show() function handle postback issue.

search nested modal popup extender this.

vb.net

dim modalpopupextender1 = ctype(yourgridview.footerrow.findcontrol("modalpopupextender1"), ajaxcontroltoolkit.modalpopupextender) modalpopupextender1.show() 

c#

ajaxcontroltoolkit.modalpopupextender modalpopupextender1 = (ajaxcontroltoolkit.modalpopupextender)yourgridview.footerrow.findcontrol("modalpopupextender1"); modalpopupextender1.show(); 

this expose buried control hidden in item template.let me know if works.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -