简体   繁体   English

如何在javascript中为radwindow设置Navigationurl?

[英]How to set navigateurl for radwindow in javascript?

How to set navigateurl for radwindow in javascript ? 如何在javascript为radwindow设置Navigationurl?

I want to use a radwindow in my page, and I use it in tow part. 我想在页面中使用radwindow,并在拖曳部分中使用它。

I have a radwindow that I use it in 2 part. 我有一个radwindow,将其分为2部分使用。

 <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. 我使用javascript显示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. 当我单击按钮时,设置radwindow = ("DefCall.aspx") Navigateurl ,当我单击其他按钮时,设置navigateurl = ("DefTask.aspx")并通过QueryString或其他方式将2值传递给子页面。

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

Check out the RadWindow API you can change the url through javascript like this RadWindow API,您可以像这样通过javascript更改网址

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

You can use window.radopen . 您可以使用window.radopen The only trick is you need to use pageLoad which is to wait until the RadWindow is fully loaded. 唯一的技巧是您需要使用pageLoad ,它要等到RadWindow完全加载后才能使用。

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>    

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM