Conditional <asp:BoundField

  • Thread starter Thread starter Romain Salad
  • Start date Start date
R

Romain Salad

I must admit I probably get less help than from this newsgroup than is
humanly possible, but I thought I'd try again:

In some circumstances I need this:

<asp:BoundField DataField="AMOUNT" HeaderText="AMOUNT"
SortExpression="AMOUNT" DataFormatString="{0:$#,#.##}" HtmlEncode="False"
But when the field is empty, i want to use a different format string. How to
accomplish?
 
You could use the OnDataBound event handler for the control that contains the
bound field then just set the DataFormatString property of the relevent field.
 
Romain you could also change it to a templatecolumn
and then check it in the codebehind
Patrick
 

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