我有一个ASP:Gridview,即使AutoGenerateSelectButton =“false”也会生成一个选择列。这是宣言:
<asp:GridView ID="grdAssessments" runat="server"
AutoGenerateColumns="False"
CssClass="gridview"
AlternatingRowStyle-CssClass="even"
AutoGenerateSelectButton="false"
DataKeyNames="ReportId"
AllowSorting="True" Width="1000px"
OnSelectedIndexChanging="grdAssessments_SelectedIndexChanging"
OnSorting="grdAssessments_Sorting"
OnRowCommand="grdAssessments_RowCommand"
OnRowDataBound="grdAssessments_RowDataBound">
<AlternatingRowStyle CssClass="even" />
<Columns>
<asp:TemplateField HeaderText="Edit">
<ItemTemplate>
<a href="javascript:void(0);"
onclick="showEmployeeEdit('<%# Eval("EmployeeNumber") %>')" title="Edit">Edit</a>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="DateCreated" SortExpression="DateCreated">
<ItemTemplate>
<asp:Label ID="lblDateCreated" runat="server" />
</ItemTemplate>
</asp:TemplateField>
...
</Columns>
</asp:GridView>
这是结果gridview ...我想要删除的Select列。
答案 0 :(得分:0)
在黑暗中拍摄:不要连接OnSelectedIndexChanging
事件。如果没有某种类型的Select Button
,你为什么要这样呢?
答案 1 :(得分:0)
解决方案是:grdAssessments.AutoGenerateSelectButton = false;
我不知道为什么这会解决问题,但确实如此。