?
Solved

.net C# repeater - conditional control

Posted on 2007-04-11
3
Medium Priority
?
565 Views
Last Modified: 2008-02-01
.net C# repeater - conditional control
I have a repeater control.
Based on certain data ( a flag) from the same database SELECT results which returned Tom, Dick and Harry;
I want to prevent the Tom row from displaying something like this:
if(flagdata !="notom"){
<tr>
 <td> Tom </td> <td><% # bounddata %></td>
</tr>
}
<tr>
 <td> dick </td> <td><% # bounddata %></td>
</tr>
<tr>
 <td> harry </td> <td><% # bounddata %></td>
</tr>

new to .net and repeate how do the experts do this??

HELP!
0
Comment
Question by:RSSIAdmin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Expert Comment

by:dmagliola
ID: 18891845
Can you clarify your problem a little bit more?

The way I understand it, there are certain rows that you don't want to show, based on the data in the table.
If that is the case, you can filter the table to remove (or hide) these rows BEFORE databinding.

Please let me know if this would be possible or not, or whether I have misunderstood the question.
0
 

Author Comment

by:RSSIAdmin
ID: 18894980
dmagliola: Your right,  but I want the balance of the data in the returned row to be display in the HTML repeater table. For example if Tom is flagged not to show.  I want the repeater table  to omit the Tom row and just display the balance of the data returned,  in this case just the Dick and Harry rows.

I want this ( note that the Tom row does not appear) i
<tr>
 <td> dick </td> <td><% # bounddata %></td>
</tr>
<tr>
 <td> harry </td> <td><% # bounddata %></td>
</tr>

<tr>
 <td> harry </td> <td><% # bounddata %></td>
</tr>

I don't want the table to look like this:
<tr>
 <td> Tom </td> <td></td>
</tr>
<tr>
 <td> dick </td> <td><% # bounddata %></td>
</tr>
<tr>
 <td> harry </td> <td><% # bounddata %></td>
</tr>

Sorry if I am not clear.
0
 
LVL 3

Accepted Solution

by:
dmagliola earned 2000 total points
ID: 18895653
Yes you are clear.
If you filter the data before data binding, the row will not show up, because it will not even exist :-)
You can filter it out using a WHERE in the SELECT clause, if you're from a database.

If for some reason you can't filter at the database level, then when you get the data in a DataTable, you can either recurse through its rows and delete the ones you don't want, or use a DataView to filter them out.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month8 days, 2 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question