Not sure if this is a good way. I’m trying to build a contact page and spray the page with contact info from sql database. The repeater control contains the record set. I want to put a condition in my aspx page that will check if the address2 has data and if so wrap the address 2data around a paragraph. i’m not sure on the proper syntax when coding in the aspx page so any help would be appreciate? Also, im not sure if this is the best way so I’m open to suggestions.
I hope that is wat your trying to do. You will notice that i shortend
DataBinder.Eval(Container.DataItem, “address2”)
to
Eval(“address2”)
Coz i did not feel like typing all that out. lol. And this is going to use reflection either way, so i prefer the shorthand.
Another way of doing it would be to make the last <p> tag empty and make it runat server and watever ID you want. Then on the ItemDataBound event, check if address2 exists. If so, use the InnerHtml property and if not set Visible to false, which will stop if from rendering the output.