【问题标题】:How to get telerik radwindow title from code behind?如何从后面的代码中获取 Telerik radwindow 标题?
【发布时间】:2015-10-17 05:09:22
【问题描述】:
如何在代码隐藏中显示 RadWindow 标题。
asp.x
<telerik:RadWindow ID="radcalllog" runat="server" model="true" Animation="none" Style="z-index: 100000;"
VisibleOnPageLoad="false" Skin="Windows7" Width="600px" KeepInScreenBounds="true"
ReloadOnShow="false" Height="450px" EnableShadow="false" Modal="true" VisibleStatusbar="false"
VisibleTitlebar="true" Behaviors="Close,Pin" Title="CALL LOG" EnableViewState="true"></telerik:RadWindow>
【问题讨论】:
标签:
asp.net
vb.net
telerik
【解决方案1】:
要从代码隐藏中显示 RadWindow,请执行以下操作:http://docs.telerik.com/devtools/aspnet-ajax/controls/window/troubleshooting/opening-from-the-server
本质上,注册一个脚本:
string script = "function f(){$find(\"" + RadWindow1.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
如果您在其中加载的内容页面没有自己的<title> 设置,Title 属性将生效。如果有,RadWindow 将表现得像一个浏览器窗口,并在其标题栏中显示该标题。为避免这种情况,请使用 OnClientPageLoad 事件来设置您自己的标题。请注意,您将需要一个自定义属性,因为它将在客户端上被覆盖:
<telerik:RadWindow runat="server" ID="rw1" myServerTitle="My title" NavigateUrl="some-page.aspx" OnClientPageLoad="OnClientPageLoad"></telerik:RadWindow>
<script>
function OnClientPageLoad(sender, args) {
sender.set_title(sender.get_element().getAttribute("myServerTitle"));
}
</script>
【解决方案2】:
如果你想从服务器端获取它,你可能想试试这行代码:
string title=radcalllog.Title;
最好的问候,
戴安娜