Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
xianxian #1
Formatting String in Datagrid
Hi guys,
does anyone know how to format strings this way:-
i have 1 column(unit_num) in my Datagrid which displays eg. "01-123"
i have to display only the floor level of the unit number, the first 2
digits(the number before the '-')
how can i do this in the "Data Formatting Expression" of the Datagrid?
thanks in advance,
xianxian
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
xianxian Guest
-
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... -
Formatting Number/String Help Needed...
Hello Friends, I am using ASP VBScript and i am trying to format a number/string. I am trying to get this: 5982749259825982 to look like... -
Formatting a string for entry into MySQL
Hi, I'm trying to generate a string that contains a <br>, to insert into a MySQL table. It appears the <br> is being stripped out either just... -
STRING FORMATTING QUESTION
My question is regarding strings in php. I have this form in which the user fills in a description. The problem is that if the user uses any... -
string formatting
I need to convert a numeric filed NUMERIC(14,3) to a string with a (european) regional currency formatting like "1.234,56". How can I achieve this,... -
Elton Wang #2
Re: Formatting String in Datagrid
Hi there,
You can process the string in datagrid_itemdatabound event.
HTH
"xianxian" <xianxian@devdex.com> wrote in message news:uA1SGvRuFHA.3236@TK2MSFTNGP14.phx.gbl...
Hi guys,
does anyone know how to format strings this way:-
i have 1 column(unit_num) in my Datagrid which displays eg. "01-123"
i have to display only the floor level of the unit number, the first 2
digits(the number before the '-')
how can i do this in the "Data Formatting Expression" of the Datagrid?
thanks in advance,
xianxian
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Elton Wang Guest
-
xianxian #3
Re: Formatting String in Datagrid
hi again,
thanks for yr reply.
this is what i did in ItemDataBound & it works =) thanks a lot!
If e.Item.ItemIndex >= 0 Then
':: Format the DataGrid columns ::
':: Get the text from column to format ::
Dim lvl As String
lvl = e.Item.Cells(4).Text
':: Replace with the formatted text ::
e.Item.Cells(4).Text = Left(lvl, 2)
End If
regards,
xianxian
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
xianxian Guest
-
Elton Wang #4
Re: Formatting String in Datagrid
Good work!
More common way to distinguish datagriditem is
If (e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
' Process
End If
HTH
"xianxian" <xianxian@devdex.com> wrote in message
news:e4ZX7ipuFHA.2212@TK2MSFTNGP15.phx.gbl...> hi again,
>
> thanks for yr reply.
> this is what i did in ItemDataBound & it works =) thanks a lot!
>
> If e.Item.ItemIndex >= 0 Then
>
> ':: Format the DataGrid columns ::
>
> ':: Get the text from column to format ::
> Dim lvl As String
> lvl = e.Item.Cells(4).Text
>
> ':: Replace with the formatted text ::
> e.Item.Cells(4).Text = Left(lvl, 2)
>
> End If
>
> regards,
> xianxian
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Elton Wang Guest



Reply With Quote

