Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > How do I find the index of a DG column with a specific name?

Reply
Thread Tools

How do I find the index of a DG column with a specific name?

 
 
Aaron
Guest
Posts: n/a
 
      08-17-2004
I have a column called "notes" which may change position in the datagrid.
How do I find the index of this column based on its name?


 
Reply With Quote
 
 
 
 
Aaron
Guest
Posts: n/a
 
      08-17-2004
Could you give me a code example?

Thanks,
Aaron


"Eliyahu Goldin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Iterate through Columns collection.
>
> Eliyahu
>
> "Aaron" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > I have a column called "notes" which may change position in the

datagrid.
> > How do I find the index of this column based on its name?
> >
> >

>
>



 
Reply With Quote
 
 
 
 
Aaron
Guest
Posts: n/a
 
      08-17-2004
Thank you very much. This is extremely helpful.


"Eliyahu Goldin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> static public int IndexByName (System.Web.UI.WebControls.DataGrid
> grid, string name)
> {
> for (int col = 0; col < grid.Columns.Count; col++)
> if (grid.Columns[col].HeaderText == name)
> return col;
> return -1;
> }
>
> Eliyahu
>
> "Aaron" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > Could you give me a code example?
> >
> > Thanks,
> > Aaron
> >
> >
> > "Eliyahu Goldin" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Iterate through Columns collection.
> > >
> > > Eliyahu
> > >
> > > "Aaron" <(E-Mail Removed)> wrote in message
> > > news:%(E-Mail Removed)...
> > > > I have a column called "notes" which may change position in the

> > datagrid.
> > > > How do I find the index of this column based on its name?
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      08-17-2004
Iterate through Columns collection.

Eliyahu

"Aaron" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> I have a column called "notes" which may change position in the datagrid.
> How do I find the index of this column based on its name?
>
>



 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      08-17-2004
static public int IndexByName (System.Web.UI.WebControls.DataGrid
grid, string name)
{
for (int col = 0; col < grid.Columns.Count; col++)
if (grid.Columns[col].HeaderText == name)
return col;
return -1;
}

Eliyahu

"Aaron" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Could you give me a code example?
>
> Thanks,
> Aaron
>
>
> "Eliyahu Goldin" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Iterate through Columns collection.
> >
> > Eliyahu
> >
> > "Aaron" <(E-Mail Removed)> wrote in message
> > news:%(E-Mail Removed)...
> > > I have a column called "notes" which may change position in the

> datagrid.
> > > How do I find the index of this column based on its name?
> > >
> > >

> >
> >

>
>



 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
sorting index-15, index-9, index-110 "the human way"? Tomasz Chmielewski Perl Misc 4 03-04-2008 05:01 PM
Find Missing Column and Extra Column Rahul Perl Misc 5 03-19-2007 06:48 PM
How to find the Column Index By Name in an ASP.Net DataGrid DBLWizard ASP .Net 1 07-19-2005 09:42 AM
redirect traffic on specific ip to specific interface mimiseh Cisco 3 06-05-2005 09:14 PM



Advertisments