[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

.net C# repeater - conditional control

Posted on 2007-04-11
3
Medium Priority
?
566 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

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
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

649 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