Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How many Repeaters do I need?

Posted on 2011-09-28
4
Medium Priority
?
193 Views
Last Modified: 2012-05-12
I'm a newbie at ASP.NET and am trying not to go down the wrong path. Can you tell me the best approach to this simplified example.

I have a data table with 4 rows of 2 columns.

I want to display either:

a) The first two rows only, in red, with checkboxes after each field

or

b) The first two rows, in red, no checkboxes, followed by the last two rows, in blue, with checkboxes after each field.

What's my best approach? Do I want 1,2 or 3 repeaters? Do I want panels? Can you outline it?

Thanks.
0
Comment
Question by:AIBMass
[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
  • 2
4 Comments
 
LVL 25

Expert Comment

by:Rouchie
ID: 36717455
Can you not just use a single gridview, which allows a datatable to be bound directly?

After binding, you can then enumerate the rows of the gridview, and create the colouring, while also showing/hiding any checkboxes that you add.
0
 

Author Comment

by:AIBMass
ID: 36717608
If I use a gridview, do I need to have my datatable contain only rows to be displayed or can I keep all the rows in the table and have the gridview show or hide whole rows? If the gridview can handle it, is it done through a filter or what?
0
 
LVL 25

Accepted Solution

by:
Rouchie earned 1000 total points
ID: 36717921
You can use something called a DataView that selects certain rows from your datatable based on criteria you specify. Then you can use that DataView as the datasource for your gridview.
0
 

Author Closing Comment

by:AIBMass
ID: 36818793
Yes, this is a better way. I had never used DataViews before, but they handled what I needed very well.

Thanks.

PS - I have this template control in my GridView

               <asp:TemplateField HeaderText="PIP">
                <ItemTemplate>
                <asp:Label runat="server" Text='<%#Eval("PIP") %>'></asp:Label>
                <asp:CheckBox ID="chkPIP" runat="server" />
                </ItemTemplate>
                <ItemStyle Width="85px" HorizontalAlign="Right"/>
                </asp:TemplateField>

Do you know how to control the visibility of the checkbox in each row?
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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 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…
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

604 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