Hi
I am trying to trigger the ShowDialog function from behind the code?
reg
D
| <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %> |
| <%@ Register Assembly="RadWindow.Net2" Namespace="Telerik.WebControls" TagPrefix="radW" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head id="Head1" runat="server"> |
| <title>Untitled Page</title> |
| </head> |
| <body> |
| <form id="Form1" method="post" runat="server"> |
| <p> |
| <b>Returning multiple Values From a Dialog</b> |
| <br /> |
| </p> |
| <script type="text/javascript"> |
| //Show the window |
| function ShowDialog() { |
| var oWnd = window.radopen(null, "DialogWindow"); |
| oWnd.SetUrl(oWnd.GetUrl()); |
| return oWnd; |
| } |
| //Called when a window is being shown. Good for setting an argument to the window |
| function OnClientShow(radWindow) { |
| //Create a new Object to be used as an argument to the radWindow |
| var arg = new Object(); |
| //Using an Object as a argument is convenient as it allows setting many properties. |
| arg.NameValue = document.getElementById("NameArea").value; |
| arg.ProfessionValue = document.getElementById("ProfessionArea").value; |
| //Set the argument object to the radWindow |
| radWindow.Argument = arg; |
| } |
| function CallBackFunction(radWindow, returnValue) { |
| if (returnValue.NameValue) document.getElementById("NameArea").value = returnValue.NameValue; |
| if (returnValue.NameValue) document.getElementById("ProfessionArea").value = returnValue.ProfessionValue; |
| } |
| // Called when a window is being closed. |
| function OnClientClose(radWindow) { |
| //Another option for passing a callback value |
| //Set the radWindow.Argument property in the dialog |
| //And read it here --> var oValue = radWindow.Argument; |
| //Do cleanup if necessary |
| } |
| </script> |
| <asp:Label ID="InjectScript" runat="server" Width="410px"></asp:Label> |
| <p> |
| Text to be modified from the dialog: |
| <br /> |
| Name: |
| <textarea id="NameArea" rows="1" cols="20">John Smith</textarea> |
| <br /> |
| Profession:<textarea id="ProfessionArea" rows="5" cols="20">VB Developer</textarea> |
| <asp:Button ID="Button1" runat="server" Text="Button" /> |
| <br /> |
| <button class="Button" style="width: 250px" onclick="ShowDialog();return false;" |
| type="button"> |
| Show dialog (force dialog refresh)</button> |
| </p> |
| <p> |
| (Open by client script) |
| <br /> |
| <radW:RadWindowManager ID="Singleton" runat="server" OnClientClose="OnClientClose" |
| OnClientShow="OnClientShow" ClientCallBackFunction="CallBackFunction" VisibleOnPageLoad="false"> |
| <Windows> |
| <radW:RadWindow ID="DialogWindow" OffsetElementId="NameArea" Left="250px" Modal="true" |
| runat="server" Width="370px" Height="310px" Title="User List Dialog" NavigateUrl="./Dialog.aspx"> |
| </radW:RadWindow> |
| </Windows> |
| </radW:RadWindowManager> |
| </p> |
| <p> |
| </p> |
| <div style="width: 456px; height: 260px; text-align: justify"> |
| <p> |
| The example is based on <strong>t</strong>elerik's demo <a href="http://www.telerik.com/r.a.d.controls/Window/Examples/DialogReturnValue/DefaultCS.aspx" |
| target='_blank"'>Returning Values From A Dialog </a>and <strong>t</strong>elerik's |
| KB article <a href="http://www.telerik.com/Default.aspx?PageId=2514&b454K=xg8&b454T=o8c" |
| target="_blank">(ID#664) Providing an argument to a dialog. Return value from a |
| dialog, assign and invoke callback function</a>. |
| </p> |
| <p> |
| The approach is the same as explained in the KB article above and the only difference |
| is that instead of only one, we are passing two values to and from the dialog. If |
| you need more values to be passed - the logic stays the same. |
| </p> |
| <p> |
| For more information, please check the comments in the code. |
| </p> |
| </div> |
| </form> |
| </body> |
| </html> |
| Imports Telerik.WebControls |
| Partial Class Default2 |
| Inherits System.Web.UI.Page |
| Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click |
| InjectScript.Text = "<script type='text/javascript'>ShowDialog()</" + "script>" |
| End Sub |
| End Class |