Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Datagrid Control (http://www.velocityreviews.com/forums/f60-asp-net-datagrid-control.html)
-   -   Format GridView with AutoGenerateColumns=true (http://www.velocityreviews.com/forums/t763160-format-gridview-with-autogeneratecolumns-true.html)

nkw 03-08-2007 10:48 PM

Format GridView with AutoGenerateColumns=true
 
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 03-08-2007 11:39 PM

Re: Format GridView with AutoGenerateColumns=true
 
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@discussions.microsoft.com> wrote in message
news:8BF614D5-FE53-4C9D-83E1-1CF4B0064CDF@microsoft.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?




nick nkw 03-09-2007 01:20 AM

Re: Format GridView with AutoGenerateColumns=true
 
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@noSpamhotmail.com> wrote in message
news:#4Vu9rdYHHA.2316@TK2MSFTNGP04.phx.gbl...
> 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@discussions.microsoft.com> wrote in message
> news:8BF614D5-FE53-4C9D-83E1-1CF4B0064CDF@microsoft.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?

>
>


Pak Lui 03-11-2007 06:49 AM

Re: Format GridView with AutoGenerateColumns=true
 
You can easily do it in the databound event of the gridview.




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





All times are GMT. The time now is 09:19 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


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