Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > hide column in data grid

Reply
Thread Tools

hide column in data grid

 
 
BK Kim
Guest
Posts: n/a
 
      09-16-2003
Hello.

I just populated my datagrid but I need to hide one of the column.

Since I need this column's data, I cannot drop that column from my store
procedure.

Is there a way I can make it invisible?

I tried

dataGrid1.Columns[1].visible = false;

but didn't work and complained that I am out of index range.

Any one know how to solve it?

Thanx in advance


 
Reply With Quote
 
 
 
 
Alvin Bruney
Guest
Posts: n/a
 
      09-16-2003
i've posted a solution to the hundred other places you posted this question
"BK Kim" <> wrote in message
news:...
> Hello.
>
> I just populated my datagrid but I need to hide one of the column.
>
> Since I need this column's data, I cannot drop that column from my store
> procedure.
>
> Is there a way I can make it invisible?
>
> I tried
>
> dataGrid1.Columns[1].visible = false;
>
> but didn't work and complained that I am out of index range.
>
> Any one know how to solve it?
>
> Thanx in advance
>
>



 
Reply With Quote
 
 
 
 
Craig Burkett
Guest
Posts: n/a
 
      09-18-2003
And you couldn't post it a 101st time?

Seriousely, what is the solution because I am having a similar problem. The
only difference is that I have a databound grid with two fixed columns and
am wanting the rest of them to be auto generated. The problem is that the
two fixed columns get duplicated in the grid because I can't keep them from
being auto-generated.

Thanks,
Craig

"Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com > wrote in
message news:...
> i've posted a solution to the hundred other places you posted this

question
> "BK Kim" <> wrote in message
> news:...
> > Hello.
> >
> > I just populated my datagrid but I need to hide one of the column.
> >
> > Since I need this column's data, I cannot drop that column from my store
> > procedure.
> >
> > Is there a way I can make it invisible?
> >
> > I tried
> >
> > dataGrid1.Columns[1].visible = false;
> >
> > but didn't work and complained that I am out of index range.
> >
> > Any one know how to solve it?
> >
> > Thanx in advance
> >
> >

>
>


 
Reply With Quote
 
Alvin Bruney
Guest
Posts: n/a
 
      09-19-2003
101 and counting
in your itemdatabound event do this:
e.item.cells[9].visible = false;
this will hide autogenerated columns. bound columns are part of the column
collection so if you have 2 bound columns your index will be 0 and 1 and you
would hide them the same way you were trying to hide them before. it can't
work for autogenerated columns because they aren't part of the columns
collection. ex if you have 2 bound columns and 4 autogenerated columns, you
only have index 0 and 1 which is why you kept getting and index out of range
when you tried to hide column 4. if you use the itemdatabound then you can
hide the 4 autogenerated columns but not the 2 bound columns for the same
reason

hope this helps

"Craig Burkett" <> wrote in message
news:...
> And you couldn't post it a 101st time?
>
> Seriousely, what is the solution because I am having a similar problem.

The
> only difference is that I have a databound grid with two fixed columns and
> am wanting the rest of them to be auto generated. The problem is that the
> two fixed columns get duplicated in the grid because I can't keep them

from
> being auto-generated.
>
> Thanks,
> Craig
>
> "Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com > wrote in
> message news:...
> > i've posted a solution to the hundred other places you posted this

> question
> > "BK Kim" <> wrote in message
> > news:...
> > > Hello.
> > >
> > > I just populated my datagrid but I need to hide one of the column.
> > >
> > > Since I need this column's data, I cannot drop that column from my

store
> > > procedure.
> > >
> > > Is there a way I can make it invisible?
> > >
> > > I tried
> > >
> > > dataGrid1.Columns[1].visible = false;
> > >
> > > but didn't work and complained that I am out of index range.
> > >
> > > Any one know how to solve it?
> > >
> > > Thanx in advance
> > >
> > >

> >
> >

>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide a button in a data grid kevinpublic@excite.com ASP .Net 3 12-07-2006 10:13 PM
How to hide a GridView column when the column's Visible property does not support databinding? Keithb ASP .Net 2 10-27-2006 05:02 AM
Is it possible to hide row/column lables in a wxPython Grid window? Kevin Dahlhausen Python 1 10-04-2004 07:20 PM
Activa or not activate a button column depending if another data column has data or not carlos perez ASP .Net 0 06-08-2004 02:16 PM
How do you alternate images in a data bound column of a data grid control? C Newby ASP .Net 7 04-02-2004 05:00 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57