我想通过lbltest
(RadGrid ItemCommand
)事件更新标签(frmRptControlledUsers
)。标签在RapControlledUsers
之外,但RadGrid在其中。
Html标记
<telerik:RadAjaxLoadingPanel ID="RALPPermissions" runat="server" EnableSkinTransparency="true" BackgroundTransparency="30">
</telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxPanel ID="RapControlledUsers" runat="server" LoadingPanelID="RALPPermissions">
<telerik:RadGrid ID="frmRptControlledUsers" RenderMode="Lightweight" runat="server">
<mastertableview>
<columns>
<telerik:gridtemplatecolumn>
<itemtemplate>
<asp:LinkButton ID="LnkDelete" runat="server" CommandName="Delete" CommandArgument='<%# Eval("ID") %>'>
Delete
</asp:LinkButton>
</itemtemplate>
</telerik:gridtemplatecolumn>
</columns>
</mastertableview>
</telerik:RadGrid>
</telerik:RadAjaxPanel>
<asp:Label ID="lbltest" runat="server"></asp:Label>
代码背后
private void RptControlledUsers_ItemCommand(object sender, GridCommandEventArgs e)
{
string Command = e.CommandName.ToString();
switch (Command.ToLower())
{
case "delete":
{
this.lbltest.Text="this is updated";
break;
}
}
}
如果有人可以解释这个问题的解决方案,那将非常有用。
答案 0 :(得分:0)
你可以在这里考虑几个选项。
使用RadAjaxManager
控件代替RadAjaxPanel
<telerik:RadAjaxManagerProxy ID="AjaxManagerProxy1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="frmRptControlledUsers">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="lbltest" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
使用ScriptManager
手动注册控件。 ScriptManager.RegisterDataItem()
。请查看这些链接以获取更多详细信息
https://msdn.microsoft.com/en-us/library/bb301423(v=vs.110).aspx#Examples