Formatting not apply

  • Thread starter Thread starter Esperanza
  • Start date Start date
E

Esperanza

Simple question.
The formatting code I use in my projet does not apply in my asp pages at
run time.
Any Idea Why ???
Thanks in advance !!!
Esperanza

Example 1
this.txtPrix.Text =
System.String.Format("{0:c}",dtrProduitVIPComposantPrix["sglPrixActuel"].ToS
tring());
result : 15.4567

Example 2
Another example this time in html to format a datagrig column in a pourcent
format

<asp:Label id=dg_lblPourc runat="server" Text='<%#
fctPourcComposant(DataBinder.Eval(Container, "DataItem.dblPourcentage")) %>'
DataFormatingString="{0:p}">
result :1.7876654433
 
I would try :
- to suppress "ToString" (in case 1 you are applying a numeric format to a
string as you used ToString)
- in case 2 try to specify the format as the 3rd argument of Eval (check the
doc but I don't remember to have seen a DataFormatingString member for the
Label control ?)
 
It's working (both)!!
Thank you so much !!
Esperanza

Patrice said:
I would try :
- to suppress "ToString" (in case 1 you are applying a numeric format to a
string as you used ToString)
- in case 2 try to specify the format as the 3rd argument of Eval (check the
doc but I don't remember to have seen a DataFormatingString member for the
Label control ?)

--
Patrice

Esperanza said:
Simple question.
The formatting code I use in my projet does not apply in my asp pages at
run time.
Any Idea Why ???
Thanks in advance !!!
Esperanza

Example 1
this.txtPrix.Text =
System.String.Format("{0:c}",dtrProduitVIPComposantPrix["sglPrixActuel"].ToS
tring());
result : 15.4567

Example 2
Another example this time in html to format a datagrig column in a pourcent
format

<asp:Label id=dg_lblPourc runat="server" Text='<%#
fctPourcComposant(DataBinder.Eval(Container, "DataItem.dblPourcentage")) %>'
DataFormatingString="{0:p}">
result :1.7876654433
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top