' Visual Basic
DataGrid1.Columns(1).Visible = Not (DataGrid1.Columns(1).Visible)
// C#
DataGrid1.Columns[1].Visible = !(DataGrid1.Columns[1].Visible);
--
Omar Squiabro
Enterprise Technologies & Software Design
Project Manager
www.etsdpr.com
Tel. 1-787-644-5981
"samuel Mesel" <> wrote in message
news:4DDD009D-0FEE-4F3E-94EC-...
> I'm developing an ASP.NET application. I have a datagrid that has
> 7 columns. The first 3 columns contain buttons (Select, Edit, and
Delete).
> The next 4 contain data (Table name, Change Description, Change Date,
> and Table ID). I need to have the Table ID of the user's selected
> table - I use it later when I go to edit or delete the table. (The
> editing is done on a seperate screen because the description field is
> larger than I want to fit into a datagrid). But, I would like to hide
> the Table ID column - the user does not need to see it.
>
> I have a problem trying to set the column's visible property to false.
> When I run the page with the code:
> Datagrid.Columns(6).visible = False
> I receive an error that the index is out of range. I receive the same
> error if I try to blank out columns 3,4, or 5. The only time it works
> correctly is when I blank out columns 0, 1, or 2 (the button columns).
> I created the button columns using the Datagrid Property Builder in the
> Visual Studio.NET IDE.
>
> Any idea how I can get the visible property to work on the non-button
> columns?
>