HighTechTalks DotNet Forums  

Format GridView with AutoGenerateColumns=true

ASP.net Data Grid Control microsoft.public.dotnet.framework.aspnet.datagridcontrol


Discuss Format GridView with AutoGenerateColumns=true in the ASP.net Data Grid Control forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
nkw
 
Posts: n/a

Default Format GridView with AutoGenerateColumns=true - 03-08-2007 , 05:48 PM






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?

Reply With Quote
  #2  
Old   
David Wier
 
Posts: n/a

Default Re: Format GridView with AutoGenerateColumns=true - 03-08-2007 , 06:39 PM






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" <nkw (AT) discussions (DOT) microsoft.com> wrote

Quote:
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?



Reply With Quote
  #3  
Old   
nick nkw
 
Posts: n/a

Default Re: Format GridView with AutoGenerateColumns=true - 03-08-2007 , 08:20 PM



I cannot bound the columns though. Sounds I need:

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

"David Wier" <david_wier (AT) noSpamhotmail (DOT) com> wrote

Quote:
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" <nkw (AT) discussions (DOT) microsoft.com> wrote in message
news:8BF614D5-FE53-4C9D-83E1-1CF4B0064CDF (AT) microsoft (DOT) com...
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?



Reply With Quote
  #4  
Old   
Pak Lui
 
Posts: n/a

Default Re: Format GridView with AutoGenerateColumns=true - 03-11-2007 , 01:49 AM



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




"nkw" <nkw (AT) discussions (DOT) microsoft.com> wrote

Quote:
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?



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.