Search code examples
javascriptasp.nettelerikradwindow

How to set navigateurl for radwindow in javascript?


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);
}

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");