Telerik RadGrid:我的“删除记录”复选框列是只读的。我该如何解决这个问题?
这是我的网格:
<telerik:RadGrid AutoGenerateColumns="False" ID="grdUsers" DataSourceID="LinqDataSource1" AllowSorting="True" runat="server" GridLines="None" Skin="Office2007">
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
<MasterTableView TableLayout="Fixed" DataSourceID="LinqDataSource1">
<CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn HeaderText="FirstName" DataField="FirstName" ReadOnly="True" SortExpression="FirstName" HeaderStyle-Width="150"></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="LastName" HeaderStyle-Width="150" DataField="LastName" ReadOnly="True" SortExpression="LastName"></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Email" DataField="Email" ReadOnly="True" SortExpression="Email"></telerik:GridBoundColumn>
<telerik:GridCheckBoxColumn HeaderText="Delete?" HeaderStyle-Width="60" ReadOnly="false"></telerik:GridCheckBoxColumn>
</Columns>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
</MasterTableView>
<FilterMenu EnableImageSprites="False"></FilterMenu>
</telerik:RadGrid>
如您所见,我在末尾有一个 GridCheckBoxColumn ,我希望用户能够选择一些记录,然后单击另一个按钮来删除它们。问题是,即使我将 ReadOnly 属性设置为 false,复选框也全部被禁用。
有什么想法吗?
Here's my grid:
<telerik:RadGrid AutoGenerateColumns="False" ID="grdUsers" DataSourceID="LinqDataSource1" AllowSorting="True" runat="server" GridLines="None" Skin="Office2007">
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
<MasterTableView TableLayout="Fixed" DataSourceID="LinqDataSource1">
<CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn HeaderText="FirstName" DataField="FirstName" ReadOnly="True" SortExpression="FirstName" HeaderStyle-Width="150"></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="LastName" HeaderStyle-Width="150" DataField="LastName" ReadOnly="True" SortExpression="LastName"></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Email" DataField="Email" ReadOnly="True" SortExpression="Email"></telerik:GridBoundColumn>
<telerik:GridCheckBoxColumn HeaderText="Delete?" HeaderStyle-Width="60" ReadOnly="false"></telerik:GridCheckBoxColumn>
</Columns>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
</MasterTableView>
<FilterMenu EnableImageSprites="False"></FilterMenu>
</telerik:RadGrid>
As you can see, I have a GridCheckBoxColumn
at the end that I would like the users to be able to select a few records and then click another button to delete them. The problem is that the check boxes are all disabled even though I set the ReadOnly
property to false.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您错误地使用了 GridCheckBoxColumn。它必须绑定到数据字段,就像 GridBoundColumn 一样。在您的情况下,您需要将 CheckBox 放置在 GridTemplateColumn 的 ItemTemplate 中。这将达到您想要的结果。
以下是 Telerik 提供的完整整个过程的链接: http://www.telerik .com/help/aspnet/grid/grddeletegriditemsdependingoncheckboxstate.html
You are using the GridCheckBoxColumn incorrectly. It must be bound to a datafield just like a GridBoundColumn. In your case, you need to place a CheckBox in an ItemTemplate of a GridTemplateColumn. This will achieve your desired result.
Here is a link from Telerik going through the entire process: http://www.telerik.com/help/aspnet/grid/grddeletegriditemsdependingoncheckboxstate.html