0

hi,

This is a bit complex..
I have 2 nested repeaters.. and 3 datasources(in markup)

<asp:SqlDataSource ID=data1 runat=server ConnectionString="<%$connectionstrings:MainServer %>" SelectCommand="select MatrixRiskFactorId,Name,MaxWeight from Matrixriskfactor" ></asp:SqlDataSource>

<asp:SqlDataSource ID=data2 runat=server ConnectionString="<%$connectionstrings:MainServer %>" SelectCommand="select * from MatrixQuestion" ></asp:SqlDataSource>

<asp:SqlDataSource ID=data3 runat=server ConnectionString="<%$connectionstrings:MainServer %>"  SelectCommand = "select MatrixRiskFactorId,Value,text from MatrixRiskFactorScore where MatrixRiskFactorId=2">


<repeater id=rep1 datasourceid=data1>
<itemtemplate>
<%# DataBinder.Eval(Container.DataItem, "Name")%>
<br/>

     <repeater id=rep2 datasourceid=data2>
     <headertemplate>
         <table>
             <th>Question</th><th>Score</th>
     <itemtemplate>
        <tr>
            <td>
            <%# DataBinder.Eval(Container.DataItem,"text") %>
            </td> 
            <td>
                <asp:RadioButtonList id=radiolist1 runat=server DataSourceID=data3 DataTextField="text" DataValueField="value" ></asp:RadioButtonList>

            </td>
        </tr>
     </ItemTemplate>

     <FooterTemplate>
        </table>

     </FooterTemplate>

     </itemtemplate>

</itemtemplate>



</repeater>

==================================================

as you can see in data3.. the where clause has a fixed value...(2)

I want to change it dynamiacally according to data1 or rep1 child control property...

i know its possible.. i just dont know how..?? :(

may be i'll have to add paramete.. but how do i set the parameter value to be depending on data1 or rep1 child control property ??

==================================================

2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by G_Waddell
1

Hi Instead of passing in a fixed datasource to your radio list you will have to dynamically set the the datasource.

You will need to use the ItemDataBound event of datarepeater 2 to capture the question value that you can then use to populate your answers. (It may be easier to "grab" the value of the question if you store it's ID in a hidden field you you can then pass into your answers query)

There is an example like this based on customers and products here: Nested ASP.NET DataRepeater

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.