I have a gridview that is populated from a sqldatasource with ajax, which is fired from a radcombox drop down. The below does not work because technically the gridview hasn't loaded. Is there an easy work around?
Protected Sub RadComboBox1_SelectedIndexChanged(sender As Object, e As RadComboBoxSelectedIndexChangedEventArgs) Handles RadComboBox1.SelectedIndexChanged
GridView1.HeaderRow.Cells(1).Visible = False
End Sub
To hide the column headers Set the DataGridView. ColumnHeadersVisible property to false .
Sometimes you will want to display a DataGridView without column headers. In the DataGridView control, the ColumnHeadersVisible property value determines whether the column headers are displayed. Set the DataGridView.ColumnHeadersVisible property to false. A DataGridView control named dataGridView1.
In the DataGridView control, the Visible property value of a column determines whether that column is displayed. There is support for this task in Visual Studio. Also see How to: Hide Columns in the Windows Forms DataGridView Control Using the Designer. Set the DataGridViewColumn.Visible property to false.
A DataGridView control named dataGridView1 that contains a column named CustomerID. References to the System and System.Windows.Forms assemblies. Basic Column, Row, and Cell Features in the Windows Forms DataGridView Control
Set the DataGridViewColumn.Visible property to false. To hide a CustomerID column that is automatically generated during data binding, place the following code example in a DataBindingComplete event handler. A DataGridView control named dataGridView1 that contains a column named CustomerID.
<asp:GridView ID="GridView1" runat="server" ShowHeader="False">
</asp:GridView>
showheader=false on the aspx page
Just hide the cell after the entire GridView is bound 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 know that this only hides the contents of the header cell, not the entire column.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With