Solved

How many Repeaters do I need?

Posted on 2011-09-28
4
185 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
  • 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 250 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

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…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

770 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