Hide gridview column header

I have a gridview that populates from sqldatasource using ajax, which is called from the radbox. The following does not work because technically gridview is not loading. Is there any easy work?

Protected Sub RadComboBox1_SelectedIndexChanged(sender As Object, e As RadComboBoxSelectedIndexChangedEventArgs) Handles RadComboBox1.SelectedIndexChanged
    GridView1.HeaderRow.Cells(1).Visible = False
End Sub
+4
source share
2 answers
<asp:GridView ID="GridView1" runat="server" ShowHeader="False">
        </asp:GridView>

showheader = false on aspx page

+12
source

Just hide the cell after binding the entire GridView in the DataBound event:

Protected Sub GridView1_DataBound(sender As Object, e As EventArgs)  
    GridView1.HeaderRow.Cells(1).Visible = False
End Sub

<asp:GridView ID="GridView1" runat="server" OnDataBound="GridView1_DataBound">

Just be aware that this only hides the contents of the header cell, not the entire column.

+3
source

Source: https://habr.com/ru/post/1547030/


All Articles