Ask a Question related to ASP.NET General, Design and Development.
-
J Gao #1
How to hide columns in Datagrid
Hi All,
I am using Data binding with DataGrid. I need to hide column in the grid
using
DataGrid1.Columns(1).Visible = False
But I get the following error message
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.ArgumentOutOfRangeException: Index was out of
range. Must be non-negative and less than the size of the collection.
Parameter name: index
Source Error:
Line 119:
Line 120: Private Sub Button1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles Button1.Click
Line 121: DataGrid1.Columns(1).Visible = False
Line 122: End Sub
Line 123:
It seems that Datagrid does not recognize the columns created at runtime.
Any idea how to do this?
Thanks in advance.
Jie
J Gao Guest
-
How to Hide & show the columns in ADVANCED DATAGRID.?
HI, Am working with Advanced Datagrid. Problem am facing is.. i want to hide & show the columns in AdvancedDataGridColumnGroup. By default am... -
CFGRID, Using Query - How do I hide columns?
This might make no sense or I might know the answer, but not know I know it ... How can I hide columns in a query generated cfgrid? You say,... -
Hide Columns
Dar all, Could any one tell me how to hide columns in datagrid in the run time? -
Columns and Inherited Datagrid...Active Schema does not support columns
I have a class which has inherited from datagrid, to provide some custom functionality, row select, mouse overs etc All is working fine apart from... -
Can you hide columns generated with AutoGenerateColumns?
I noticed that columns generated with AutoGenerateColumns are not part of the columns collection. So how can they be hidden at run time? Thanks... -
J Gao #2
Re: How to hide columns in Datagrid
I got it. Use
Private Sub DataGrid1_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid1.ItemCreated
Select Case e.Item.ItemType
Case ListItemType.Header
e.Item.Cells(1).Visible = False
e.Item.Cells(2).Visible = False
End Sub
"J Gao" <jie.gao@tequilasoftware.com> wrote in message
news:uJa7CwFUDHA.2180@TK2MSFTNGP12.phx.gbl...ByVal> Hi All,
> I am using Data binding with DataGrid. I need to hide column in the grid
> using
> DataGrid1.Columns(1).Visible = False
>
> But I get the following error message
>
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information
> about the error and where it originated in the code.
>
> Exception Details: System.ArgumentOutOfRangeException: Index was out of
> range. Must be non-negative and less than the size of the collection.
> Parameter name: index
>
> Source Error:
>
> Line 119:
> Line 120: Private Sub Button1_Click(ByVal sender As System.Object,> e As System.EventArgs) Handles Button1.Click
> Line 121: DataGrid1.Columns(1).Visible = False
> Line 122: End Sub
> Line 123:
>
>
> It seems that Datagrid does not recognize the columns created at runtime.
>
> Any idea how to do this?
>
> Thanks in advance.
>
>
>
> Jie
>
>
J Gao Guest



Reply With Quote

