GridView Dynamic Column

Discussion in 'ASP .Net' started by =?Utf-8?B?TWFyayBQYXJ0ZXI=?=, May 27, 2005.

  1. I'm adding a dynamic column to a gridview control at runtime but I'm
    encountering a problem whereby I can only add 1 item to the column header.

    The column header should show the date in the format dd/mm but I need to
    store the full date (e.g. dd/mm/yyyy) in a hidden field for the column but
    only the last item in code is being rendered. Can you only add 1 item to a
    column?

    CODE---------------------------

    For i = 8 To (e.Row.Cells.Count - 1)
    classDate = CType(e.Row.Cells(i).Text, Date)
    classDateHidden = New HiddenField
    classDateHidden.Value = classDate.ToShortDateString
    e.Row.Cells(i).Controls.Add(classDateHidden)
    e.Row.Cells(i).Text = String.Format("{0:dd<br />/MM}",
    classDate)
    Next
    =?Utf-8?B?TWFyayBQYXJ0ZXI=?=, May 27, 2005
    #1
    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. John E.
    Replies:
    3
    Views:
    4,459
    masoud bayan
    Mar 25, 2005
  2. Keith G Hicks
    Replies:
    3
    Views:
    763
    Keith G Hicks
    Feb 18, 2008
  3. johnsonlim026
    Replies:
    0
    Views:
    932
    johnsonlim026
    Feb 27, 2010
  4. bsm

    Dynamic GridView with Dynamic Column

    bsm, May 15, 2007, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    847
  5. John E.

    Move bound column to right of dynamic column in datagrid?

    John E., Mar 24, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    231
    Elton Wang
    Mar 28, 2005
Loading...

Share This Page