Question

How to set navigateurl for radwindow in javascript ?

I want to use a radwindow in my page, and I use it in tow part.

I have a radwindow that I use it in 2 part.

 <telerik:RadWindowManager ID="RadWindowManager1" ShowContentDuringLoad="false"
              VisibleStatusbar="false"  
         RegisterWithScriptManager="True" 
        EnableShadow="True" ReloadOnShow="true" Width="800px" Height="550px" 
      runat="server">
      <Windows>
            <telerik:RadWindow ID="modalPopup" runat="server" Modal="True"
      >
      </telerik:RadWindow>
 </Windows></telerik:RadWindowManager>

I use javascript for show radwindow.

<telerik:RadCodeBlock runat="server" ID="rdbScripts">
      <script type="text/javascript">

          function showDialogInitially() {
              var wnd = $find("<%=modalPopup.ClientID %>");
              wnd.show();
              Sys.Application.remove_load(showDialogInitially);
          }

When I click on a button , set Navigateurl of radwindow = ("DefCall.aspx") and when I click to other button , set navigateurl = ("DefTask.aspx") and passe 2 value to the child page by QueryString or other way.

protected void btnDefCall_Click(object sender, EventArgs e)
{
        string strURL = string.Format("../PhoneCall/DefPhoneCall.aspx
    ?FormTypeID={0}&FormID={1}", number1,number2);
  modalPopup.NavigateUrl = strURL;

    ScriptManager.RegisterStartupScript(Page, GetType(), "PopupScript", string.Format("javascript:showDialogInitially()"), true);

}


 protected void btnDefTask_Click(object sender, EventArgs e)
{
    string strURL = string.Format("../Task/DefTask.aspx?FormTypeID={0}&FormID={1}", (int)clsHelper.FormType.Lead, int.Parse(Request.QueryString["ID"].ToString()));
 modalPopup.NavigateUrl = strURL;

    ScriptManager.RegisterStartupScript(Page, GetType(), "PopupScript", string.Format("javascript:showDialogInitially()"), true);
}
Was it helpful?

Solution

Check out the RadWindow API you can change the url through javascript like this

var wnd = $find("<%=modalPopup.ClientID %>");
wnd.setUrl("http://www.google.com");

OTHER TIPS

You can use window.radopen. The only trick is you need to use pageLoad which is to wait until the RadWindow is fully loaded.

protected void btnDefTask_Click(object sender, EventArgs e)
{
    var script = string.Concat(
        "function pageLoad() { showDialogInitially('",
        "http://www.telerik.com",
        "'); }");

    ScriptManager.RegisterStartupScript(Page, GetType(), 
       "PopupScript", script, true);
}

<telerik:RadWindowManager 
    ID="RadWindowManager1" 
    ShowContentDuringLoad="false"
    VisibleStatusbar="false"  
    RegisterWithScriptManager="True" 
    EnableShadow="True" 
    ReloadOnShow="true" 
    Width="800px" Height="550px" 
    runat="server">
      <Windows>
        <telerik:RadWindow ID="modalPopup" runat="server" Modal="True">
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>    
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
    <script type="text/javascript">
        function showDialogInitially(url) {
            window.radopen(url, "modalPopup");
            return false;
        }
    </script>
</telerik:RadScriptBlock>    
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top