Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controllig rows in Repeater

Status
Not open for further replies.

developer155

Programmer
Jan 21, 2004
512
0
0
US
Hi I have a repeater that looks like this.
<b><%# DataBinder.Eval(Container.DataItem, "CampaignName") %></b><br />
<b>SOM: <%# DataBinder.Eval(Container.DataItem, "CampaignReferenceId") %></b><br />
<b>Advertiser Name: <%# DataBinder.Eval(Container.DataItem, "AdvertiserName") %></b><br />
<b>AdvertiserID: ......

So rows are hardcoded. Sometimes we do not get data for certain columns, so is there a way to dynamically delete those rows from repeater? Liek if AdvertiserName is NULL do not show Advertiser Name: in results?

thanks!!!
 
Remove the rows using SQL that you are using to populate the datasource.
 
And if you can't do that for some reason, you can consider, e.g., a DataView to filter records on the app server.
 
Thanks everyone. I am still not 100% clear:
if I remove the output from SQL stored proc, I will still have Advertiser Name and Advertiser ID on the template, won't I? Those are hard-code right now in the repeater....
<b>Advertiser Name: <%# DataBinder.Eval(Container.DataItem, "AdvertiserName") %></b><br />

What I am trying to say is that even though Container.DataItem, "AdvertiserName") will not return any value (by the way, will it crash?) then I will still have Advertiser Name: part

thanks!
 
Rather than write out the repeater like you have, try using a label for each field title. You can then just get a reference to the label and set it's Visible property based on whether the value from the database exists.

You should also remove your outdated HTML tags (such as the <b> tags in your example) and use CSS instead.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top