如何识别 RadListBox 的 ItemTemplate 内 LinkButton 的 CommandName
我向我的 radlistbox 添加了一个项目模板,并在其中添加了一个标签和两个链接按钮...
我的 radlistbox 如下所示:
<telerik:RadListBox ID="RadlbOfImageGroup" runat="server" DataKeyField="ID" DataSortField="Title"
DataSourceID="sdsImagesGroup" DataTextField="Title" DataValueField="ID" Skin="BlackByMe"
EnableEmbeddedSkins="False" Width="260px" Height="365px" EmptyMessage="no rec!"
AutoPostBack="True" OnSelectedIndexChanged="RadlbOfImageGroup_SelectedIndexChanged"
CausesValidation="False">
<ItemTemplate>
<table style="width: 100%;">
<tr style="width: 100%;">
<td style="width: 64%;">
<asp:Label ID="lblTitleOfIG" runat="server" CssClass="lbl_ListBox_IG_Title" Text='<%# Eval("Title") %>'></asp:Label>
</td>
<td style="width: 18%; text-align: center;">
<asp:LinkButton ID="lbEditIG" runat="server" CausesValidation="False" CommandName="Edit"
CssClass="lb_ListBox_IG" OnClick="lbEditIG_Click">Edit</asp:LinkButton>
</td>
<td style="width: 18%; text-align: center;">
<asp:LinkButton ID="lbDeleteIG" runat="server" CausesValidation="False" CommandName="Delete"
CssClass="lb_ListBox_IG" OnClick="lbDeleteIG_Click">Delete</asp:LinkButton>
</td>
</tr>
</table>
</ItemTemplate>
</telerik:RadListBox>
我的问题是,当我单击上面的代码中的 LinkButtons 时,如何检查它们的 CommandName? (我们无权访问代码隐藏中的这些 LinkButton)
我知道我们不需要这些 LinkButton 的 CommandName /我只是想知道是否可以从代码隐藏中读取它们?
I added an itemtemplate to my radlistbox and also added one label and two linkbutton(s) in it ...
my radlistbox is like below :
<telerik:RadListBox ID="RadlbOfImageGroup" runat="server" DataKeyField="ID" DataSortField="Title"
DataSourceID="sdsImagesGroup" DataTextField="Title" DataValueField="ID" Skin="BlackByMe"
EnableEmbeddedSkins="False" Width="260px" Height="365px" EmptyMessage="no rec!"
AutoPostBack="True" OnSelectedIndexChanged="RadlbOfImageGroup_SelectedIndexChanged"
CausesValidation="False">
<ItemTemplate>
<table style="width: 100%;">
<tr style="width: 100%;">
<td style="width: 64%;">
<asp:Label ID="lblTitleOfIG" runat="server" CssClass="lbl_ListBox_IG_Title" Text='<%# Eval("Title") %>'></asp:Label>
</td>
<td style="width: 18%; text-align: center;">
<asp:LinkButton ID="lbEditIG" runat="server" CausesValidation="False" CommandName="Edit"
CssClass="lb_ListBox_IG" OnClick="lbEditIG_Click">Edit</asp:LinkButton>
</td>
<td style="width: 18%; text-align: center;">
<asp:LinkButton ID="lbDeleteIG" runat="server" CausesValidation="False" CommandName="Delete"
CssClass="lb_ListBox_IG" OnClick="lbDeleteIG_Click">Delete</asp:LinkButton>
</td>
</tr>
</table>
</ItemTemplate>
</telerik:RadListBox>
My Problem is how can I check the CommandName of LinkButtons in code above when I click on them?
(We don't have access to these LinkButtons in CodeBehind)
I know we do not need CommandName for those LinkButtons / I Just want to know is it possible to read them from codebehind?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定这是否是解决此问题的标准方法,但这就是我使用的方法:
上面的示例是在 VB.Net 中,但如果您使用的是 C#,则应该相当容易地转换为 C#。
I'm not sure if this is a standard way of addressing this issue but it's what I use:
The above example is in VB.Net but should translate fairly easily to C# if that's what you're using.
这是 Telerik 团队引入的代码:
here is the code that has been introduced by telerik team :