Dynamically set FormView

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
 
G

gsauns

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") %>
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top