Solved

.net C# repeater - conditional control

Posted on 2007-04-11
3
558 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

856 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