Dynamically set FormView

  • Thread starter Thread starter gsauns
  • Start date Start date
G

gsauns

I have a FormView control bound to a data source.
Right now, I am working with the regular old ItemTemplate. I have one
field that I would like to set a label's Text property equal to (easy
enough with <%# Eval("Field") %>), UNLESS that field is blank/null,
then I would like to set it to some text, like "None Specified".

I've been trying to set the label's Text dynamically, but haven't had
any luck. Anyone have a method I could use to accomplish this? (Code-
behind is C#)

Thanks
 
To anyone that needs it, here was the eventual solution. I set the
label's Text property to:

<%# Eval("Field").ToString().Equals(string.Empty) ? "None Specified" :
Eval("Field") %>
 
Back
Top