473,749 Members | 2,356 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 3233

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 .com>
| From: tom pester <To************ ********@pandor a.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.publi c.dotnet.framew ork.aspnet
| Date: Thu, 25 Aug 2005 14:40:49 -0700
| NNTP-Posting-Host: d51a4b60e.acces s.telenet.be 81.164.182.14
| Lines: 1
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP15.phx. gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1203 77
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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******** ******@TK2MSFTN GXA01.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 .com>
| From: tom pester <To************ ********@pandor a.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.publi c.dotnet.framew ork.aspnet
| Date: Thu, 25 Aug 2005 14:40:49 -0700
| NNTP-Posting-Host: d51a4b60e.acces s.telenet.be 81.164.182.14
| Lines: 1
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP15.phx. gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1203 77
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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(DataB inder.Eval(Cont ainer.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 .com>
<x7************ **@TK2MSFTNGXA0 1.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.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: newman.ncua.gov 207.15.63.4
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP10.phx. gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1204 97
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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******** ******@TK2MSFTN GXA01.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 .com>
| > | From: tom pester <To************ ********@pandor a.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.publi c.dotnet.framew ork.aspnet
| > | Date: Thu, 25 Aug 2005 14:40:49 -0700
| > | NNTP-Posting-Host: d51a4b60e.acces s.telenet.be 81.164.182.14
| > | Lines: 1
| > | Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP15.phx. gbl
| > | Xref: TK2MSFTNGXA01.p hx.gbl
| > microsoft.publi c.dotnet.framew ork.aspnet:1203 77
| > | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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
18726
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 with only 2 decimals (#,##0.00)? In the sample below, amount and taxrate are existing DataColumn's. DataColumn colTax = new DataColumn(); colTax.DataType = System.Type.GetType("System.String"); colTax.ColumnName = "tax";...
11
1548
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 total of hours and minutes like this: on database: 70,5 on datagrid: 01:10:30
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 I enter into the column "data formatting expression" to make the one column act as a column with hyperlinks.
1
1859
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 with this? Thanks
7
7799
by: Volodymyr Lozovoy | last post by:
Hi All, who suggest why subj do not affect on displayed result for date?
1
1480
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 to {0:#.##}. When I run this on my test IIS server all is sweet. When I post this to my Apache server, I get a FormatException. If I change the format expression to one of the pre-defined ones (like {0:g}), then I don't get a FormatException.
3
1660
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
3739
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 grid is filled with a column from a table that is varChar(500). I only want to display the first 50 character of that column. I want to be able to use the "Data Formatting Expression" in the datagrid columns property page. I could only find...
6
4607
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 works fine: Text='<%# Eval("Price", ApplicationContext.CurrencyFormat) %>'
0
8832
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9566
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9388
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9333
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6800
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.