472,805 Members | 1,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 3159

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
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
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
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
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
by: Volodymyr Lozovoy | last post by:
Hi All, who suggest why subj do not affect on displayed result for date?
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...
3
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
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
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...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.