Solved

How many Repeaters do I need?

Posted on 2011-09-28
4
188 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 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

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

Suggested Solutions

Title # Comments Views Activity
edit .asp files 5 49
Could not load file or assembly 'Microsoft.Web.Infrastructure 4 41
ASP.NET (VB) return a record 2 52
Change to file doesn't show up 16 80
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

730 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