472,805 Members | 3,611 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 software developers and data experts.

Matrix question and nested repeaters

Hi,
I'm trying to render a Matrix question in my ASP.Net 2.0 page, A matrix
question is a question where you have several options that can all be rated
according to several possible ratings (from less to more for example).
I have a question object that has two properties that contain the
collections Options and Ratings.
now I want this kind of layout:
---
Rating1 Rating2 Rating3
Option 1 () () ()
Option 2 () () ()
Option 3 () () ()
---
The ()'s are radiobuttons.
I'm creaing the Matrix question as a Web User Control (.ascx page).
The web user control get's the question set in a property that I've added
called Question.

Now I've created a repeater that has it's datasource set to Options. And in
the header template I want to write the ratings (later I also want to create
the radiobuttons by creating a nested repeater over the ratings in the item
template).
---
<asp:Repeater ID="MatrixRepeater" runat="server">
<HeaderTemplate>
<table>
<tr>
<td>
</td>
<asp:Repeater runat="server" ID="HeaderRepeated"
DataSource="Question.Ratings">
<ItemTemplate>
<td><%# Eval(Container.DataItem, "Text") %>
</td>
</ItemTemplate>
</asp:Repeater>
</tr>
</HeaderTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
---
My first question is: What do I write where I set the datasource for the
HeaderRepeater, where I've written "Question.Ratings"?
My Web User Control (.ascx) has a property named Question that has a
property called Ratings that I want to use as datasource.

My second question: Is this a good design, using Repeater controls, or is
there a better way to get the output I'm seeking?

Kind Regards,
Allan Ebdrup
Dec 20 '06 #1
2 4167
I found a solution:
---
<asp:Repeater ID="MatrixRepeater" runat="server">
<HeaderTemplate>
<table>
<tr>
<td>
&nbsp;
</td>
<asp:Repeater runat="server" DataSource="<%#
((Controls_Survey_Questions_MatrixQuestion)Contain er.Parent.Parent).Question.Ratings
%>">
<ItemTemplate>
<td valign="bottom">
<%# Eval("Text")%>
</td>
</ItemTemplate>
</asp:Repeater>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%# Eval("Text") %>
</td>
<asp:Repeater ID="RatingsRepeater" runat="server"
DataSource="<%#((Controls_Survey_Questions_MatrixQ uestion)Container.Parent.Parent).Question.Ratings
%>">
<ItemTemplate>
<td valign="top" align="center">
<cc1:GlobalRadioButton
ID="GlobalRadioButton1" runat="server"
GlobalGroup="true"
GroupName="<%#
((CopenhagenSoftware.UserFeedback.QuestionOption)( (RepeaterItem)Container.Parent.Parent).DataItem).I d
%>"
/>
</td>
</ItemTemplate>
</asp:Repeater>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
---

I don't think that all the dotting to Parent.Parent and casting is very
pretty but it works, now all I have to figure out is how to retrieve what
radiobuttons were clicked.

I'm using the GlobalRadioButton control I found here:
http://metabuilders.com/Tools/GlobalRadioButton.aspx
Because of the probles ASP.Net has with having radiobuttons belonging to the
same group inside repeater controls.

Kind Regards,
Allan Ebdrup
Dec 20 '06 #2
Hi Allan,

It seems you've found the solution yourself. I'm not sure if you have more
questions or not. Please feel free to reply here to let me know if there's
anything I can help.

Have a nice day and Merry Christmas!
Sincerely,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Dec 21 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: DonRex | last post by:
Hello all! I couldn't find a web application-newsgroup for ASP.NET, so I'm sorry if this is the wrong forum! Synopsis: In my webform I have 3 nested repeaters: rpWeeks ----- rpTime
0
by: Machi | last post by:
> let say i created nested repeaters in HTML page of a particular Web Form Parent repeater dubbed >> "parentRepeater", child Repeater dubbed "childRepeater" . Withi "parentRepeater" and...
0
by: Machi | last post by:
let say in parent-child scenerio (Product: Product Category - one product category may has many products), i am using nested repeaters where parent repeater will be used to display info and child...
0
by: kettch | last post by:
Is it possible to have nested repeaters three layers deep I have gotten it to work with only two, and when I tried to get the third layer to work COD <asp:repeater id="rep"...
1
by: jeremystein | last post by:
With nested repeaters, how can I access the outer repeater's DataItem from the inner repeater? Here's a snippet from my aspx: <asp:repeater id="OuterRepeater" runat="server"...
1
by: mavrick_101 | last post by:
Hi, I have nested repeaters. But the page breaks if I refresh 2 or 3 times. It breaks with the following error message.. "Timeout expired. The timeout period elapsed prior to obtaining a...
2
by: Josh | last post by:
I have a nested repeater situation with a Link Button on the nested repeater. However when the link button is clicked I get a postback but the event never takes place. I'm trying to wire up the...
1
PrinsonG
by: PrinsonG | last post by:
My Query is How do I export to excel/csv using Nested Repeaters. My project is web-based and i am using C#.Net. In this i use three repeaters. one displays ID, Name of the user. second...
3
by: Leon Mayne | last post by:
If I have a datatable which looks like this: Record Id, Group Id, Name 1, 1, Test 1 2, 1, Test 2 3, 2, Test 3 4, 3, Test 4 Is it possible to use nested repeaters to group the information by...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.