Skip to content Skip to sidebar Skip to footer

Control Lightbox (modal) From Code-behind Of Asp.net

Before meeting with Ajax and Jquery, in my projects I had a function like below. Public Sub Raise_Alarm(ByVal p_Page As Page, ByVal p_Message As String, Optional ByVal p_IsError A

Solution 1:

If you want to use jqModal as suggested by cxfx above (+1;), this should work:

strScript = "$('<div>" & p_Message.Replace("'", "\'") & "</div>').jqm();";
ClientScriptManager.RegisterStartupScript(p_Page.GetType(), "alert", strScript, true);

Solution 2:

Try one of the excellent jQuery plugins for displaying modal windows such as jqModal. The docs explain how to configure and launch your modal window, and include some great examples.

Solution 3:

If you are using "thickbox" it can just display a noraml aspx page in a modal window. You can then use code behind as normal.

<htmlxmlns="http://www.w3.org/1999/xhtml" ><headrunat="server"><metahttp-equiv="Content-type"content="text/html; charset=utf-8" /><linkhref="/themes/ui.all.css"rel="stylesheet"type="text/css" /><linkrunat="server"href="/styles/thickbox.css"rel="stylesheet"type="text/css" /><!-- jQuery --><scripttype="text/javascript"src="/scripts/jquery-1.3.2.js"></script><scripttype="text/javascript"src="/scripts/ui.core.js"></script><scripttype="text/javascript"src="/scripts/thickbox.js"></script></head><body><aclass="thickbox"href="mylink.aspx?KeepThis=true&TB_iframe=true&height=300&width=850">modal thick box link</a></body></html>

Hope this helps.

Post a Comment for "Control Lightbox (modal) From Code-behind Of Asp.net"