Professional Web Applications Themes

How do I find the index of a DG column with a specific name? - ASP.NET Data Grid Control

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?...

Sponsored Links
  1. #1

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

    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?


    Sponsored Links
    Aaron Guest

  2. #2

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

    Could you give me a code example?

    Thanks,
    Aaron


    "Eliyahu Goldin" <removemeegoldinmonarchmed.com> wrote in message
    news:uTWme9FhEHA.2544TK2MSFTNGP10.phx.gbl...
    > Iterate through Columns collection.
    >
    > Eliyahu
    >
    > "Aaron" <aaronjonharvey.com> wrote in message
    > news:%231J3s0FhEHA.1972TK2MSFTNGP09.phx.gbl...
    > > 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?
    > >
    > >
    >
    >

    Aaron Guest

  3. #3

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

    Thank you very much. This is extremely helpful.


    "Eliyahu Goldin" <removemeegoldinmonarchmed.com> wrote in message
    news:uuTVGeGhEHA.2928TK2MSFTNGP10.phx.gbl...
    > 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" <aaronjonharvey.com> wrote in message
    > news:%23N1W3BGhEHA.1652TK2MSFTNGP09.phx.gbl...
    > > Could you give me a code example?
    > >
    > > Thanks,
    > > Aaron
    > >
    > >
    > > "Eliyahu Goldin" <removemeegoldinmonarchmed.com> wrote in message
    > > news:uTWme9FhEHA.2544TK2MSFTNGP10.phx.gbl...
    > > > Iterate through Columns collection.
    > > >
    > > > Eliyahu
    > > >
    > > > "Aaron" <aaronjonharvey.com> wrote in message
    > > > news:%231J3s0FhEHA.1972TK2MSFTNGP09.phx.gbl...
    > > > > 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?
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    Aaron Guest

  4. #4

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

    Iterate through Columns collection.

    Eliyahu

    "Aaron" <aaronjonharvey.com> wrote in message
    news:%231J3s0FhEHA.1972TK2MSFTNGP09.phx.gbl...
    > 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?
    >
    >

    Eliyahu Goldin Guest

  5. #5

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

    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" <aaronjonharvey.com> wrote in message
    news:%23N1W3BGhEHA.1652TK2MSFTNGP09.phx.gbl...
    > Could you give me a code example?
    >
    > Thanks,
    > Aaron
    >
    >
    > "Eliyahu Goldin" <removemeegoldinmonarchmed.com> wrote in message
    > news:uTWme9FhEHA.2544TK2MSFTNGP10.phx.gbl...
    > > Iterate through Columns collection.
    > >
    > > Eliyahu
    > >
    > > "Aaron" <aaronjonharvey.com> wrote in message
    > > news:%231J3s0FhEHA.1972TK2MSFTNGP09.phx.gbl...
    > > > 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?
    > > >
    > > >
    > >
    > >
    >
    >

    Eliyahu Goldin Guest

Similar Threads

  1. add specific column values based on first column value
    By Unregistered in forum Brainstorming Area
    Replies: 0
    Last Post: September 28th, 05:12 PM
  2. Find specific column names AND their values.
    By walkeraj00 in forum Coldfusion Database Access
    Replies: 2
    Last Post: January 24th, 06:17 AM
  3. Replies: 4
    Last Post: October 6th, 10:04 PM
  4. Get clicked column index
    By Marcin Gorzynski in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: September 29th, 10:34 AM
  5. Which is the best column to insert index...
    By fabriZio in forum Microsoft SQL / MS SQL Server
    Replies: 0
    Last Post: June 30th, 02:37 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139