Solved

.net C# repeater - conditional control

Posted on 2007-04-11
3
547 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
  • 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 500 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now