Click here to Skip to main content
15,887,434 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi experts,

Can you guide me to pop up an modalpopup box on page_load using c# in asp.net? The calling code should be in code behind page. I have to place an dropdown list in the box.
As usual I should not use jquery or scripts to call the modal pop up box.

Kindly replay ASAP,
Sathish Kumar S
Posted
Updated 27-Jan-11 21:39pm
v2
Comments
JF2015 28-Jan-11 3:40am    
Removed unnecessary pre tags.
Pravin Patil, Mumbai 28-Jan-11 3:47am    
Why don't you use script..?
sathya4260 28-Jan-11 3:48am    
its client advice

I don't think it is possible to do so using asp.net only. You can use AJAX to show a modal pop.
Refer to http://www.asp.net/ajax/ajaxcontroltoolkit/samples/modalpopup/modalpopup.aspx for more details.
 
Share this answer
 
Comments
sathya4260 28-Jan-11 3:50am    
By Ajax only can you provide the code to call the model popup in Page_Load method
Pravin Patil, Mumbai 28-Jan-11 5:05am    
You can find a very nice example at http://www.dotnetcurry.com/ShowArticle.aspx?ID=285
sathya4260 28-Jan-11 9:29am    
hi patil,

If if do as per tat article, i am getting the modelpopup but it goes off by dopostback, can tell me how to stop the dopostback of button event...
Pravin Patil, Mumbai 28-Jan-11 10:00am    
Will definitely try it for you.
place this code :
ModalPop1.Show(); 
 
Share this answer
 
Comments
sathya4260 28-Jan-11 9:27am    
it showing error as TargetControlId cannot be empty
birbalkumar 22-Aug-12 16:13pm    
Hi experts,
Can you guide me to pop up an modalpopup box on button_click using c# in asp.net? The calling code should be in code behind page.
I will use it in online exam where after clicking on option it should show answer
correct or uncorrect
the code is like this.....
if (result.Equals("CORRECT"))
Response.Redirect("checkresult.aspx?subtopicid=" + cDynamicData.Ssubtopicid + "&ans=" + result); {

}
else
{
lblError.Text = "Wrong Choice ! Please select another option";
}
when answer is wrong the javascript popup is displaying but when its correct it will simply redirect to next question.
for popup i am using div


StringBuilder sb = new StringBuilder();
sb.Append("$(function() { ");
sb.Append(" $('#dialog').dialog({");
sb.Append(" width: 300,");
sb.Append(" });");
sb.Append("});");
Page.ClientScript.RegisterStartupScript(typeof(Page), "myscript", sb.ToString(), true);
Kindly replay ASAP,
birbal

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