Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Datagrid Control (http://www.velocityreviews.com/forums/f60-asp-net-datagrid-control.html)
-   -   hide column in data grid (http://www.velocityreviews.com/forums/t759510-hide-column-in-data-grid.html)

BK Kim 09-16-2003 03:25 AM

hide column in data grid
 
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



Alvin Bruney 09-16-2003 03:40 AM

Re: hide column in data grid
 
i've posted a solution to the hundred other places you posted this question
"BK Kim" <bkkim@destinationrx.com> wrote in message
news:OatWLIAfDHA.4024@TK2MSFTNGP11.phx.gbl...
> 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
>
>




Craig Burkett 09-18-2003 08:07 PM

Re: hide column in data grid
 
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:ul164QAfDHA.616@tk2msftngp13.phx.gbl...
> i've posted a solution to the hundred other places you posted this

question
> "BK Kim" <bkkim@destinationrx.com> wrote in message
> news:OatWLIAfDHA.4024@TK2MSFTNGP11.phx.gbl...
> > 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
> >
> >

>
>



Alvin Bruney 09-19-2003 02:17 AM

Re: hide column in data grid
 
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" <cburkett@triadd.rr.com> wrote in message
news:OCBmWCifDHA.3284@tk2msftngp13.phx.gbl...
> 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:ul164QAfDHA.616@tk2msftngp13.phx.gbl...
> > i've posted a solution to the hundred other places you posted this

> question
> > "BK Kim" <bkkim@destinationrx.com> wrote in message
> > news:OatWLIAfDHA.4024@TK2MSFTNGP11.phx.gbl...
> > > 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
> > >
> > >

> >
> >

>





All times are GMT. The time now is 02:16 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.