473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

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?
Mar 8 '07 #1
3 7753
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" <nk*@discussions.microsoft.comwrote in message
news:8B**********************************@microsof t.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?

Mar 8 '07 #2
I cannot bound the columns though. Sounds I need:

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

"David Wier" <da********@noSpamhotmail.comwrote in message
news:#4**************@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" <nk*@discussions.microsoft.comwrote in message
news:8B**********************************@microsof t.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?

Mar 9 '07 #3
You can easily do it in the databound event of the gridview.


"nkw" <nk*@discussions.microsoft.comwrote in message
news:8B**********************************@microsof t.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?

Mar 11 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Andy Sutorius | last post by:
Can someone point me to an article on how to edit a datagrid when the grid is set to autogeneratecolumns? Each article I have come across has instructions when autogenerate is false and you have...
0
by: Sachin | last post by:
Hi All, I am using ASP.NET 2.0 and GridView control. I have a stored procedure, SP_GetAllRows which takes the table name as parameter and fires the query "Select * from TableName" dynamically....
1
by: kashif456 | last post by:
I can't figure out why I am getting error updating, deleting and inserting new rows. I am amble to get my dataview populated and also detailview populated: Here's my code: <%@ Page...
3
by: =?Utf-8?B?c2xlbWVu?= | last post by:
Hi, My GridView is bound to a DataTable and the GridView properties are set as follows: AutoGenerateColumns="true" AutoGenerateEditButton="true" AutoGenerateDeleteButton="true" The Edit and...
2
by: BillE | last post by:
I am populating a gridview using auto-generated fields, because I need to enable sorting. I would like to format a column containing dates in the gridview. How is this done? Thanks Bill
10
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I understand how to connect a SqlDataSource to a GridView and have a nice data-connected, paginated web page generated with virtually no coding. Starting from that base, I would like to add an...
2
by: Aamir Ghanchi | last post by:
Hello, I would like to hear if any one else is having the same problem. The AutoGenerateColumns property is set to true. I can read the data right and can loop through the datasource's...
4
by: Yin99 | last post by:
I have a Gridview binding to a DataTable source. I'd like to set the column with of the second column. I cannot do this apparently because when AutoGenerateColumns=true, they do not appear in the...
11
by: giveDsolution | last post by:
Hope to find the Solution, My requirment is, I have set AutoGenerateColumns=True for a gridview as i have to add columns at runtime. My first question is: How to hide a column ? And my second...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.