从gridview中删除列

时间:2013-10-04 17:12:06

标签: html asp.net c#-4.0 gridview

我想从gridview中删除此列我尝试在grdiview的dropdownlist中添加值但是当我添加它时工作正常但是这个黑色的列出现...  我怎么删除它..

grdiview html

 <asp:BoundField DataField="DocType" HeaderText="Document" />
                   <asp:BoundField DataField="DepType" HeaderText="Department" />

                   <asp:BoundField HeaderText="ApproveID" DataField="ApproveID" 
             ></asp:BoundField>
            <asp:TemplateField>
                <ItemTemplate>
                   <asp:Label ID="lblCountry" runat="server" Text='<%# 
        Eval("ApproveID") %>' Visible = "false" />

                    <asp:DropDownList ID="DropDownList4" runat="server"
           class="vpb_dropdown">
                    </asp:DropDownList>
                </ItemTemplate>
            </asp:TemplateField>


               </Columns>

1 个答案:

答案 0 :(得分:0)

首先确保在GridView上设置AutoGenerateColumns =“false”,然后删除行

<asp:BoundField HeaderText="ApproveID" DataField="ApproveID"></asp:BoundField>
来自HTML的

。关闭AutoGenerateColumns时,需要手动添加每列。