javascript - how to call modalPopup from custom validator code -
i want show user friendly messages using custom validator , modal popup extender.
here design :
<ajaxtoolkit:modalpopupextender id="mpe" runat="server" targetcontrolid="hdvalue" popupcontrolid="panelalert" backgroundcssclass="modalbackground1" dropshadow="true" cancelcontrolid="btncancel"> </ajaxtoolkit:modalpopupextender> <asp:panel id="panelalert" runat="server" cssclass="modalpopup" width="233px" style = "display:none"> <div class="sidesection_top" style="float: left; height: 15px;" align="left"> <div style="float: left; width: 192px; height: 15px;" align="left"> registration alert</div> <div style="float: right; width: 32px; height: 15px;" align="right"> <asp:imagebutton id="imgbtnclose" runat="server" imageurl="images/close_button.jpg" borderwidth="0px" /> </div> </div> <div> <div align="left" style="padding-left: 5px; padding-bottom: 5px;"> <span id="lblalertmsg"><asp:label id="label5" runat="server"></asp:label></span> </div> <div align="right" style="padding-right: 10px; height: 25px;"> <asp:button id="okbutton" runat="server" text="continue" cssclass="button"/> <asp:button id="cancelbutton" runat="server" text="cancel" cssclass="button"/><br> </div> </div> </asp:panel>
here code :
protected void customvalidator1_servervalidate(object source, servervalidateeventargs args) { using(dataclassesdatacontext db = new dataclassesdatacontext()) { var query = db.users.where(x => x.username.equals(txtusername.text.trim())).select(x => x).singleordefault(); if (query == null) { args.isvalid = true; } else { mpe.show(); label5.text = "userid exist."; okbutton.visible = false; args.isvalid = false; } } }
how ever check debugging it's calling function how ever modal pop not showing @ front side.
please me....
your markup , code looks ok. javascript errors in browser console ?
have checked make sure you've included in page: -
<%@ register assembly="ajaxcontroltoolkit" namespace="ajaxcontroltoolkit" tagprefix="ajaxtoolkit" %>
Comments
Post a Comment