Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Late answer, but maybe not too late. I'm a litte bit confused by your question, I will just answer this part :</p> <blockquote> <p>What we really want is to be able to invoke this from any code behind in some fashion like:</p> <p>Page.ShowMessage("Hello lightbox!")</p> </blockquote> <p>Let's do it with Thickbox and jQuery, that's what I'm familiar with, but this will give you the general idea to reproduce it with Lightview. First, you'll need a client script to convert the "Hello lightbox!" message into a html element and then use it as an inline content with TB. To do that, we will create a div with id myTBInline:</p> <pre><code>function showMessage(message) { var divId = "myTBInline"; // You can change this id... var div = $("#" + divId); // try to retrieve the div if it exists if (div.length &gt; 0) // if div already exists (previous call) div.empty(); // then remove its content else div = $('&lt;div id="' + divId + '"/&gt;'); // else create it // add the message to the div div.append(message); // display Thickbox using the div as inline element tb_show("Message", "#TB_inline?height=200&amp;width=300&amp;inlineId=" + divId, null); } </code></pre> <p>This was the hard part. Now comes the easy part, being able to call that from the code behind. You'll have to add a method, where you want as it can be static/shared. I normally use C#, but I'll try to write it with VB Syntax for you (the last time I used VB.Net was back in 2005 ;)</p> <pre><code>Public Shared Class Thickbox Public Shared Sub ShowMessage(Type type, string message) Dim script as String = "showMessage('" + message.Replace("'", "\'") + "');"; ClientScriptManager.RegisterStartupScript(type, "Thickbox", script, true); End Sub End Class </code></pre> <p>Here you go. From within your page, you can use the method this way :</p> <pre><code>Thickbox.ShowMessage(GetType(), "Hello Thickbox!"); </code></pre> <p>Check out this <a href="https://stackoverflow.com/questions/625326/control-lightbox-modal-from-code-behind-of-asp-net">other question</a> on SO. The implementation uses jqModal and is very small (no need for a client script).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload