Solved

How many Repeaters do I need?

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

691 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