Format GridView with AutoGenerateColumns=true

Discussion in 'ASP .Net' started by =?Utf-8?B?bmt3?=, Mar 8, 2007.

  1. I have a gridview which need to filled by various data according to user's
    action. I want to format the dynamical displayed data. For example the number
    should be right aligned, datetime column using short format, etc.

    Anyway to implement it? Can RowDataBound event do it? Sounds I need to know
    the binding columns' data source type (?_ and set the format of the gridview
    columns according to the type. Is it possible?
     
    =?Utf-8?B?bmt3?=, Mar 8, 2007
    #1
    1. Advertising

  2. =?Utf-8?B?bmt3?=

    David Wier Guest

    You've got to have something there, to be able to format - especially since
    you want to have different columns formatted differently - at least you will
    need to have boundcolumns, in order to create formatting for each one.

    I would think that it might be possible in the rowDatabound event, though
    I've never tried it, but you'd need to go by cell number
    --
    David Wier
    MVP/ASPInsider
    http://aspnet101.com
    http://aspexpress.com

    "nkw" <> wrote in message
    news:...
    > I have a gridview which need to filled by various data according to user's
    > action. I want to format the dynamical displayed data. For example the

    number
    > should be right aligned, datetime column using short format, etc.
    >
    > Anyway to implement it? Can RowDataBound event do it? Sounds I need to

    know
    > the binding columns' data source type (?_ and set the format of the

    gridview
    > columns according to the type. Is it possible?
     
    David Wier, Mar 8, 2007
    #2
    1. Advertising

  3. =?Utf-8?B?bmt3?=

    nick nkw Guest

    I cannot bound the columns though. Sounds I need:

    1. Capture the column rendering event
    2. Get the bound data column type

    "David Wier" <> wrote in message
    news:#...
    > You've got to have something there, to be able to format - especially
    > since
    > you want to have different columns formatted differently - at least you
    > will
    > need to have boundcolumns, in order to create formatting for each one.
    >
    > I would think that it might be possible in the rowDatabound event, though
    > I've never tried it, but you'd need to go by cell number
    > --
    > David Wier
    > MVP/ASPInsider
    > http://aspnet101.com
    > http://aspexpress.com
    >
    > "nkw" <> wrote in message
    > news:...
    >> I have a gridview which need to filled by various data according to
    >> user's
    >> action. I want to format the dynamical displayed data. For example the

    > number
    >> should be right aligned, datetime column using short format, etc.
    >>
    >> Anyway to implement it? Can RowDataBound event do it? Sounds I need to

    > know
    >> the binding columns' data source type (?_ and set the format of the

    > gridview
    >> columns according to the type. Is it possible?

    >
    >
     
    nick nkw, Mar 9, 2007
    #3
  4. =?Utf-8?B?bmt3?=

    Pak Lui Guest

    You can easily do it in the databound event of the gridview.




    "nkw" <> wrote in message
    news:...
    >I have a gridview which need to filled by various data according to user's
    > action. I want to format the dynamical displayed data. For example the
    > number
    > should be right aligned, datetime column using short format, etc.
    >
    > Anyway to implement it? Can RowDataBound event do it? Sounds I need to
    > know
    > the binding columns' data source type (?_ and set the format of the
    > gridview
    > columns according to the type. Is it possible?
     
    Pak Lui, Mar 11, 2007
    #4
    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. David M. Weprin
    Replies:
    0
    Views:
    423
    David M. Weprin
    Oct 16, 2003
  2. Andy Sutorius
    Replies:
    2
    Views:
    2,163
    Sandeep Kayal
    Jun 30, 2004
  3. Sachin
    Replies:
    0
    Views:
    2,460
    Sachin
    Mar 5, 2006
  4. bdb112
    Replies:
    45
    Views:
    1,372
    jazbees
    Apr 29, 2009
  5. nkw

    Format GridView with AutoGenerateColumns=true

    nkw, Mar 8, 2007, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    952
    Pak Lui
    Mar 11, 2007
Loading...

Share This Page