Solved

How many Repeaters do I need?

Posted on 2011-09-28
4
183 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now