473,507 Members | 12,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Data Formatting Expression for datagrid

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
Nov 19 '05 #1
4 3221

Can you paste the line you use to display the name (there are 100's of ways
of doing this).

The string class has a method toUpper...

Cheers,
Tom Pester
Hi,
How can I format a string field using Data Formatting Expression
property in
datagrid?
For example: format last name from BROWN to Brown.
Thank

Nov 19 '05 #2
Hi Hope,

Welcome to ASP.NET newsgroup.
As for the data formatting in DataGrid question, I think Tom's suggestion
is reasonable since we could have multi means to display the databiding
expression and the way we have to adjust it depends on the way to bind it.
So how are you binding the string within datagrid curently? Generally we
can adjust the databinding string directly in the aspx's inline databinding
expression or use a helper function to do the formatting. Please feel free
to post here if you have any further concerns.

Thanks & Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| Message-ID: <a1***************************@news.microsoft.co m>
| From: tom pester <To********************@pandora.be>
| Subject: Re: Data Formatting Expression for datagrid
| References: <##**************@TK2MSFTNGP09.phx.gbl>
| MIME-Version: 1.0
| Content-Transfer-Encoding: 8bit
| Content-Type: text/plain; charset=iso-8859-1; format=flowed
| X-Newsreader: JetBrains Omea Pro 661.1
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Date: Thu, 25 Aug 2005 14:40:49 -0700
| NNTP-Posting-Host: d51a4b60e.access.telenet.be 81.164.182.14
| Lines: 1
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP15.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:120377
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
|
| Can you paste the line you use to display the name (there are 100's of
ways
| of doing this).
|
| The string class has a method toUpper...
|
| Cheers,
| Tom Pester
|
| > 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

|
|

Nov 19 '05 #3
Thank you for your answers.

I was seeking a lazy way of formatting string data directly in the data
formatting expression property of datagrid without either writing my own
format type nor manipulate data while retrieving.

I would like to take advantage of asp.net if there is a way to format string
data that is similar to datetime formatting {0:yy-MM-dd}, say, using the
syntax something like {0:Aa*} ?

My datagrid is binding to a dataset which was returned by a stored
procedure. The raw data looks like this:
BROWN (All upper case)
jackson (All lower case)
Ford (the right format)

What I really want is to display them consistently in datagrid:
Brown
Jackson
Ford

Thanks.

"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:x7**************@TK2MSFTNGXA01.phx.gbl...
Hi Hope,

Welcome to ASP.NET newsgroup.
As for the data formatting in DataGrid question, I think Tom's suggestion
is reasonable since we could have multi means to display the databiding
expression and the way we have to adjust it depends on the way to bind it.
So how are you binding the string within datagrid curently? Generally we
can adjust the databinding string directly in the aspx's inline databinding expression or use a helper function to do the formatting. Please feel free to post here if you have any further concerns.

Thanks & Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| Message-ID: <a1***************************@news.microsoft.co m>
| From: tom pester <To********************@pandora.be>
| Subject: Re: Data Formatting Expression for datagrid
| References: <##**************@TK2MSFTNGP09.phx.gbl>
| MIME-Version: 1.0
| Content-Transfer-Encoding: 8bit
| Content-Type: text/plain; charset=iso-8859-1; format=flowed
| X-Newsreader: JetBrains Omea Pro 661.1
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Date: Thu, 25 Aug 2005 14:40:49 -0700
| NNTP-Posting-Host: d51a4b60e.access.telenet.be 81.164.182.14
| Lines: 1
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP15.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:120377
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
|
| Can you paste the line you use to display the name (there are 100's of
ways
| of doing this).
|
| The string class has a method toUpper...
|
| Cheers,
| Tom Pester
|
| > 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

|
|

Nov 19 '05 #4
Thanks for your followup Hope,

Yes, I agree with you that it's better to do the formatting work at
rendering time rather than the data retrieving time, that' why we generally
suggest use databinding expression to embeded some formatting operation.
For your scenario, since there hasn't any direct keyword or format
provider, the most convenient means would be write a custom helper function
which translate the string value from the original value to our expected
value. For example, we can define a protected function in page class or a
public static funciton in a helper class and reference them in our
datagrid's databinding expression like:

<%# Translate(DataBinder.Eval(Container.DataItem,"name ")) %>

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "hope" <ho**@newsgroup.nospam>
| References: <##**************@TK2MSFTNGP09.phx.gbl>
<a1***************************@news.microsoft.co m>
<x7**************@TK2MSFTNGXA01.phx.gbl>
| Subject: Re: Data Formatting Expression for datagrid
| Date: Fri, 26 Aug 2005 10:35:34 -0400
| Lines: 94
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
| Message-ID: <#N**************@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: newman.ncua.gov 207.15.63.4
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:120497
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thank you for your answers.
|
| I was seeking a lazy way of formatting string data directly in the data
| formatting expression property of datagrid without either writing my own
| format type nor manipulate data while retrieving.
|
| I would like to take advantage of asp.net if there is a way to format
string
| data that is similar to datetime formatting {0:yy-MM-dd}, say, using the
| syntax something like {0:Aa*} ?
|
| My datagrid is binding to a dataset which was returned by a stored
| procedure. The raw data looks like this:
| BROWN (All upper case)
| jackson (All lower case)
| Ford (the right format)
|
| What I really want is to display them consistently in datagrid:
| Brown
| Jackson
| Ford
|
| Thanks.
|
|
|
|
|
| "Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
| news:x7**************@TK2MSFTNGXA01.phx.gbl...
| > Hi Hope,
| >
| > Welcome to ASP.NET newsgroup.
| > As for the data formatting in DataGrid question, I think Tom's
suggestion
| > is reasonable since we could have multi means to display the databiding
| > expression and the way we have to adjust it depends on the way to bind
it.
| > So how are you binding the string within datagrid curently? Generally we
| > can adjust the databinding string directly in the aspx's inline
| databinding
| > expression or use a helper function to do the formatting. Please feel
| free
| > to post here if you have any further concerns.
| >
| > Thanks & Regards,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| >
| > --------------------
| > | Message-ID: <a1***************************@news.microsoft.co m>
| > | From: tom pester <To********************@pandora.be>
| > | Subject: Re: Data Formatting Expression for datagrid
| > | References: <##**************@TK2MSFTNGP09.phx.gbl>
| > | MIME-Version: 1.0
| > | Content-Transfer-Encoding: 8bit
| > | Content-Type: text/plain; charset=iso-8859-1; format=flowed
| > | X-Newsreader: JetBrains Omea Pro 661.1
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | Date: Thu, 25 Aug 2005 14:40:49 -0700
| > | NNTP-Posting-Host: d51a4b60e.access.telenet.be 81.164.182.14
| > | Lines: 1
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP15.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:120377
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > |
| > | Can you paste the line you use to display the name (there are 100's of
| > ways
| > | of doing this).
| > |
| > | The string class has a method toUpper...
| > |
| > | Cheers,
| > | Tom Pester
| > |
| > | > 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
| >
| > |
| > |
| >
|
|
|

Nov 19 '05 #5

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

Similar topics

3
18653
by: J | last post by:
Is there anyway to format a calculated datacolumn? I would like the following column to display as money (formatted as $#,##0.00). Or how about simply displaying the column formatted as a number...
11
1515
by: Diogo Alves - Software Developer | last post by:
Hi, I have a datagrid listing data from a database, and I am getting from the database real value (it's actually represents a total of minutes). What I want to do is Convert that number to a...
0
309
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...
1
1842
by: Dexter | last post by:
Hello all, I have a DataGrid in my Web Application, and it contains a column that i need to format. The data is 03856219000126 and i need to show as 03.856.219/0001-26. Somebody can help me...
7
7790
by: Volodymyr Lozovoy | last post by:
Hi All, who suggest why subj do not affect on displayed result for date?
1
1471
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...
3
1643
by: Franck | last post by:
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
2
3725
by: =?Utf-8?B?Uml0YUc=?= | last post by:
Hello. I could not find a Web discussion group (only saw Web Services) so am posting my question here. I have a C# Web application that has a form with a datagrid. One of the columns of the data...
6
4575
by: Tomasz J | last post by:
Hello developers, I bind my TextBox control specyfying a format stored in my application global ApplicationContext object - it has a static string CurrencyFormat property. The problem - this...
1
7030
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
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5041
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...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.