sorting datagrid columns with variable names

Discussion in 'ASP .Net' started by davey.phillips@gmail.com, Feb 28, 2007.

  1. Guest

    I have a datagrid within a datagrid which is filled with data from an
    SQL Server db. Each inner datagrid is populated by an sql statement
    which contains a variable column name. Output looks something like
    this:

    Dept no_valid no_invalid
    a 4 1
    b 7 2
    c 3 5

    Team no_valid no_invalid
    a1 2 1
    a2 1 0
    b1 3 0


    The 2nd and 3rd column titles are always the same, the first column
    title is taken from the variable column name in the SQL statement
    (stored procedure). This is then passed to a string, and I do

    <code>
    e.Item.Cells(0).Text = str_header_name
    </code>

    in the subroutine that handles each line of the inner datagrid.

    When I run the page, the second and third columns appear as hyperlinks
    and allow me to sort. The first doesn't, cos it's name's a variable.

    Is there any way for me to get this to appear as a hyperlink, and have
    standard sort functionality?

    Any help would be greatly appreciated, but please go easy on me, cos
    I'm a total noob to asp.

    Cheers.
     
    , Feb 28, 2007
    #1
    1. Advertising

  2. DaveyP Guest

    On 28 Feb, 11:46, wrote:
    > I have a datagrid within a datagrid which is filled with data from an
    > SQL Server db. Each inner datagrid is populated by an sql statement
    > which contains a variable column name. Output looks something like
    > this:
    >
    > Dept no_valid no_invalid
    > a 4 1
    > b 7 2
    > c 3 5
    >
    > Team no_valid no_invalid
    > a1 2 1
    > a2 1 0
    > b1 3 0
    >
    > The 2nd and 3rd column titles are always the same, the first column
    > title is taken from the variable column name in the SQL statement
    > (stored procedure). This is then passed to a string, and I do
    >
    > <code>
    > e.Item.Cells(0).Text = str_header_name
    > </code>
    >
    > in the subroutine that handles each line of the inner datagrid.
    >
    > When I run the page, the second and third columns appear as hyperlinks
    > and allow me to sort. The first doesn't, cos it's name's a variable.
    >
    > Is there any way for me to get this to appear as a hyperlink, and have
    > standard sort functionality?
    >
    > Any help would be greatly appreciated, but please go easy on me, cos
    > I'm a total noob to asp.
    >
    > Cheers.


    <<bump>>
     
    DaveyP, Mar 1, 2007
    #2
    1. Advertising

  3. DaveyP Guest

    Sorted.

    I did a regex to replace the datagrid.HeaderText.

    Problem solved.
     
    DaveyP, Mar 2, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    5
    Views:
    614
  2. wanwan
    Replies:
    3
    Views:
    445
    Alex Martelli
    Oct 14, 2005
  3. News123
    Replies:
    2
    Views:
    472
    John Machin
    Nov 26, 2008
  4. rob thomson
    Replies:
    0
    Views:
    274
    rob thomson
    Sep 4, 2003
  5. ton
    Replies:
    2
    Views:
    212
    Alvin Bruney [MVP]
    Feb 11, 2004
Loading...

Share This Page