Click here to Skip to main content
15,907,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.. friends I have web page on which on text box txtName and on button btnSubmit, I want to show modal popup when click on btnSubmit but my problem is that it should be show only when the txtName not emty. Is here any suggestion or method.

Thanks & Regards
Parveen Rathi
Posted

Hi Praveen
Try this

on your button click
C#
if(!string.isnullorempty(txtName.text))
Modelpopup.show();
else
modelpopup.hide();

You can alse achive this using the java script onclientclick event of button
JavaScript
txtName=$get("<%= txtName.ClientID %>").value
ModalPopupExtender1=$find("<%=ModalPopupExtender1.ClientID %>").Value; 
 
if(txtName !=null)
ModalPopupExtender1.show();
else
ModalPopupExtender1.hide();


Hope it will help you

Thanks
 
Share this answer
 
v2
write this code on the click of your button
C#
if(!string.IsNullOrEmpty(txtName.text))
this.modalpopup.show();


dont set the target controlid of your button same as this button as it will not allow to post back and fire the click event.

Feel free to ask any another doubt regarding the same.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900