Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello guys..,
I want to open a modal popup from server side after checking some condtions.
I tried many codes but they didn't work.
Here's what I am using now ..


string strScript;
        Type jsType = ObjPage.GetType();
        ClientScriptManager CS = ObjPage.ClientScript;
        strScript = "javascript:window.showModalDialog('ChangePassword.aspx');";
        System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, jsType, "LoginButton", strScript, true);





Any help will be appreciated....
Posted
Comments
Brij 14-Sep-10 4:01am    
From where, you are calling this registered script

1 solution

Hi Lokesh,

Please do the following from HTML:
VB
<asp:ModalPopupExtender ID="mpeDemo" BehaviorID="mpebDemo" runat="server" TargetControlID="hylPopup"
                    PopupControlID="Panel1" BackgroundCssClass="popupwrapper_transparentbg" DropShadow="false"
                    RepositionMode="RepositionOnWindowScroll" PopupDragHandleControlID="pnlConnectDragHandle"
                    OkControlID="lbtnCancel" />


Please do the following from Server:
C#
Button1_Click(object sender, EventArgs e)
{
   //some login write here...
   mpeDemo.Show(); //then open the AJAX Modal Window
}



Please do let me know, if you have any doubt.

Please provide Vote if this would be helpful to you.

Thanks,
Imdadhusen
 
Share this answer
 
Comments
Lokesh Zende 14-Sep-10 4:32am    
Hi Sunasara..
Thanks for your reply.

I already have a page which I want to open as a modal popup.
Can u help me with that.

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