Skip to content

Instantly share code, notes, and snippets.

@abdullahtariq1171
Created June 15, 2015 16:41
Show Gist options
  • Save abdullahtariq1171/e77acd041bdfd34f7016 to your computer and use it in GitHub Desktop.
Save abdullahtariq1171/e77acd041bdfd34f7016 to your computer and use it in GitHub Desktop.
<asp:Repeater runat="server" ID="repeater1" onitemdatabound="Repeater1_ItemDataBound" >
<ItemTemplate>
<!--Print Question Statement Here -->
<asp:repeater id="repeater2" runat="server">
<itemtemplate>
<!--Print Choices Here -->
</itemtemplate>
</asp:repeater>
</ItemTemplate>
</asp:Repeater>
.
.
.
.
.
.
.
.
.
.
.
.
.
Here is Function
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
//it return current row (think in terms of nested loops)
DataRowView drv = (DataRowView)e.Item.DataItem;
// get value of that row
int postID = Convert.ToInt32(drv["PostID"]); ////get you QuestionID or what ever which identify you question
//now using that questinoID get options of that questions and bind it with Repeater2
Repeater2.DataSource = //some data like you did in outer repeater
Repeater2.DataBind();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment