0

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);
}
1
  • Did you try visiting Telerik Site Commented Mar 3, 2014 at 12:54

2 Answers 2

3

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");
Sign up to request clarification or add additional context in comments.

Comments

0

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>    

5 Comments

I use this code, script type="text/javascript"> var strURL = ""; function OpenWindow(url) { strURL = url; Sys.Application.add_load(ow); } function ow() { var oWnd = radopen(strURL, 'modalPopu'); Sys.Application.remove_load(ow); }
But when I close modalwindow and refresh MyPage , modalwindow open again
It is because browser calls btnDefTask_Click again. It is browser's default behavior, and there is nothing you can do about it. One way to prevent it is to use Javascript at client side to open RadWindows instead of server side button click with ScriptManager.
What do I do to fix this problem, that when the page reloads again , the last button or command , not call?
When I call a button for delete or save , and reload page again, call the last button or command again :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.