473,386 Members | 1,969 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,386 software developers and data experts.

datagrid : change the string formatting expression

hello,

i'm looking for code (C# preferably)
in order to change programmatically in a datagrid
the string formatting expression of one bound colum

thank you
Nov 19 '05 #1
3 1639
Franck wrote:
hello,

i'm looking for code (C# preferably)
in order to change programmatically in a datagrid
the string formatting expression of one bound colum

thank you


Example:

<%# DataBinder.Eval(Container.DataItem, "MyDate", "{0:d}")%>

Will format the DateTime to display as short-date, ie dd.mm.yyyy or
other format based on the culture.

The third parameter is the format expression.

Go read MSDN.
--
Emil Christopher Melar
Nov 19 '05 #2
Franck wrote:
hello,

i'm looking for code (C# preferably)
in order to change programmatically in a datagrid
the string formatting expression of one bound colum

thank you


Sorry, Ignore my last post, I didn't read your post well enough.

Again, sorry.

--
Emil Christopher Melar
Nov 19 '05 #3
Franck wrote:
hello,

i'm looking for code (C# preferably)
in order to change programmatically in a datagrid
the string formatting expression of one bound colum

thank you


I do not have enough information.

The only solution that I can think of, is that you have to drop the
aspx-style binding to the column, and rather do this in ItemDataBound by
referencing the datasource from the e.Item.DataItem and reference a
control (literal or whatever) in the ItemTemplate instead.

Where do you want to change the format string, based on what criteria?

--
Emil Christopher Melar
Nov 19 '05 #4

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

Similar topics

7
by: ilona | last post by:
Hi all, I store phone numbers in the database as 123447775665554(input mask is used for input, and some numbers have extensions), and I also know from db if the number is Canadian, US, or some...
0
by: Alex | last post by:
I have a dataset bound datagrid. I added my own columns (autogenerate=false). However I can't figure out how to display a hyperlink string coming from the DB as a functioning hyperlink. What can...
3
by: chuckdfoster | last post by:
I have a hyperlink column in my datagrid. I want my hyperlink to be green or red (depending on in/out status) no matter if the link has been visited or not. How can I accomplish this? I have...
4
by: yer darn tootin | last post by:
Does anyone know the sort expression for a column that's data has been returned in the format, eg '07 Jul 05'?? The sort expression {..:"dd mmm yy"} doesn't work ( if the column was returned as...
1
by: camelweb | last post by:
Hi, There doesn't seem to be a usenet group for Mono programming, so I thought I'd post my question here. In Visual Studio I set the data formatting expression for one of my DataGrid columns...
5
by: cwbp17 | last post by:
Hi all, Have a datagrid that displays the price column of a table. Went to the Datagrid's Property builder and set the 'Data Formatting expression' for the PRICE column to {0:c}, so that the...
4
by: hope | last post by:
Hi, How can I format a string field using Data Formatting Expression property in datagrid? For example: format last name from BROWN to Brown. Thanks
7
by: L. Scott M. | last post by:
Have a quick simple question: dim x as string x = "1234567890" ------------------------------------------------------- VB 6 dim y as string
6
by: Jack | last post by:
Hi there, Given a standard .NET string, does anyone know what the regular expression would be to locate each (optional) formatting item in the string (or more likely does anyone have a link that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.