[英]How to set navigateurl for radwindow in javascript?
如何在javascript
為radwindow設置Navigationurl?
我想在頁面中使用radwindow,並在拖曳部分中使用它。
我有一個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>
我使用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);
}
當我單擊按鈕時,設置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);
}
簽出RadWindow API,您可以像這樣通過javascript更改網址
var wnd = $find("<%=modalPopup.ClientID %>");
wnd.setUrl("http://www.google.com");
您可以使用window.radopen 。 唯一的技巧是您需要使用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.