2013-03-27 85 views
0

我有一個ASP:即使AutoGenerateSelectButton =「false」生成選擇列的Gridview。這是聲明: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 ...與我想擺脫選擇列。

enter image description here

回答

0

解決方案是:grdAssessments.AutoGenerateSelectButton = false;

我不知道爲什麼這解決了問題,但它確實如此。

0

瞎猜:不要接了OnSelectedIndexChanging事件。爲什麼你會想要沒有某種類型的Select Button

+0

沒有。那不是。 – 2013-03-28 20:26:32