Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Data Formatting Expression for datagrid

Reply
Thread Tools

Data Formatting Expression for datagrid

 
 
hope
Guest
Posts: n/a
 
      08-25-2005
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


 
Reply With Quote
 
 
 
 
tom pester
Guest
Posts: n/a
 
      08-25-2005

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



 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      08-26-2005
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: <(E-Mail Removed) m>
| From: tom pester <(E-Mail Removed)>
| Subject: Re: Data Formatting Expression for datagrid
| References: <##(E-Mail Removed)>
| 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

|
|

 
Reply With Quote
 
hope
Guest
Posts: n/a
 
      08-26-2005
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]" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
> 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: <(E-Mail Removed) m>
> | From: tom pester <(E-Mail Removed)>
> | Subject: Re: Data Formatting Expression for datagrid
> | References: <##(E-Mail Removed)>
> | 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
>
> |
> |
>



 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      08-29-2005
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" <(E-Mail Removed)>
| References: <##(E-Mail Removed)>
<(E-Mail Removed) m>
<(E-Mail Removed)>
| 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: <#(E-Mail Removed)>
| 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]" <(E-Mail Removed)> wrote in message
| news(E-Mail Removed)...
| > 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: <(E-Mail Removed) m>
| > | From: tom pester <(E-Mail Removed)>
| > | Subject: Re: Data Formatting Expression for datagrid
| > | References: <##(E-Mail Removed)>
| > | 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
| >
| > |
| > |
| >
|
|
|

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C/C++ language proposal: Change the 'case expression' from "integral constant-expression" to "integral expression" Adem C++ 42 11-04-2008 12:39 PM
datagrid-changing data formatting expression at runtime Richard Roche ASP .Net Web Controls 0 10-05-2005 05:13 PM
Mono, DataGrid and Data formatting expression camelweb@bigpond.com ASP .Net 1 05-30-2005 03:11 PM
ASP/DataGrid/BoundColumn/Data formatting expression fo Date? Volodymyr Lozovoy ASP .Net 7 12-09-2004 04:09 PM
Data formatting expression wanted for dataset bound datagrid column for href Alex ASP .Net 0 04-14-2004 04:03 PM



Advertisments