Click here to Skip to main content
15,898,134 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: repeater control Pin
Abhijit Jana11-Aug-09 10:36
professionalAbhijit Jana11-Aug-09 10:36 
GeneralRe: repeater control Pin
deep7611-Aug-09 10:47
deep7611-Aug-09 10:47 
GeneralRe: repeater control Pin
Venkatesh Mookkan11-Aug-09 15:57
Venkatesh Mookkan11-Aug-09 15:57 
GeneralRe: repeater control Pin
deep7612-Aug-09 5:12
deep7612-Aug-09 5:12 
GeneralRe: repeater control Pin
Venkatesh Mookkan12-Aug-09 5:23
Venkatesh Mookkan12-Aug-09 5:23 
GeneralRe: repeater control Pin
deep7612-Aug-09 5:26
deep7612-Aug-09 5:26 
GeneralRe: repeater control Pin
Venkatesh Mookkan12-Aug-09 5:31
Venkatesh Mookkan12-Aug-09 5:31 
GeneralRe: repeater control Pin
deep7612-Aug-09 6:41
deep7612-Aug-09 6:41 
Thank You. That was helpful, but I am not there yet.
I modified my code to use nested repeater with database.
Now I get the following error where I create the relation between the questions and answers tables:

"System.ArgumentException: This constraint cannot be enabled as not all values have corresponding parent values.
Line 81: ds.Relations.Add("myrelation",
Line 82: ds.Tables["questions"].Columns["QID"],
Line 83: ds.Tables["answers"].Columns["QID"]);"

Here is my nested repeater code:
asp file:
<!-- start parent repeater -->
<asp:repeater id="parentRepeater" runat="server">
<itemtemplate>
<b><%# DataBinder.Eval(Container.DataItem,"QID") %>:&nbsp;</b>
<b><%# DataBinder.Eval(Container.DataItem,"Question") %></b><br>

<!-- start child repeater -->
<asp:repeater id="childRepeater" datasource='<%# ((DataRowView)Container.DataItem)
.Row.GetChildRows("myrelation") %>' runat="server">

<itemtemplate>
<%# DataBinder.Eval(Container.DataItem, "[\"Answer\"]")%><br>
</itemtemplate>
</asp:repeater>
<!-- end child repeater -->

</itemtemplate>
</asp:repeater>
<!-- end parent repeater -->
=========================================
axpx.cs file:

protected void CreateQuiz()
{
//Create the connection and DataAdapter for the questions table.
SqlConnection cnn = new SqlConnection(connectionString);
SqlDataAdapter cmd1 = new SqlDataAdapter("select QID, Question from Curriculum_Questions where ChapterID='2'",cnn);

//Create and fill the DataSet.
DataSet ds = new DataSet();
cmd1.Fill(ds,"questions");

//Create a second DataAdapter for the answers table.
SqlDataAdapter cmd2 = new SqlDataAdapter("select QID, Answer from Curriculum_Answers",cnn);
cmd2.Fill(ds,"answers");

//Create the relation bewtween the questions and answers tables.
ds.Relations.Add("myrelation",
ds.Tables["questions"].Columns["QID"],
ds.Tables["answers"].Columns["QID"]);

//Bind the questions table to the parent Repeater control, and call DataBind.
parentRepeater.DataSource = ds.Tables["questions"];
Page.DataBind();

//Close the connection.
cnn.Close();
}

Any clues?

Thanks.
GeneralRe: repeater control Pin
Venkatesh Mookkan12-Aug-09 6:49
Venkatesh Mookkan12-Aug-09 6:49 
GeneralRe: repeater control Pin
deep7612-Aug-09 6:54
deep7612-Aug-09 6:54 
GeneralRe: repeater control Pin
deep7612-Aug-09 7:03
deep7612-Aug-09 7:03 
GeneralRe: repeater control Pin
Venkatesh Mookkan12-Aug-09 7:10
Venkatesh Mookkan12-Aug-09 7:10 
GeneralRe: repeater control Pin
Venkatesh Mookkan12-Aug-09 7:07
Venkatesh Mookkan12-Aug-09 7:07 
GeneralRe: repeater control Pin
deep7612-Aug-09 9:20
deep7612-Aug-09 9:20 
QuestionASP.NET Configuration Problem Pin
pampam11011-Aug-09 10:19
pampam11011-Aug-09 10:19 
AnswerRe: ASP.NET Configuration Problem Pin
Abhijit Jana11-Aug-09 10:42
professionalAbhijit Jana11-Aug-09 10:42 
GeneralRe: ASP.NET Configuration Problem Pin
pampam11012-Aug-09 22:21
pampam11012-Aug-09 22:21 
GeneralRe: ASP.NET Configuration Problem Pin
pampam11015-Aug-09 11:35
pampam11015-Aug-09 11:35 
GeneralRe: ASP.NET Configuration Problem Pin
JacSophie13-Jan-10 15:10
JacSophie13-Jan-10 15:10 
QuestionSome Help on how to assign a Web Service to a NamedPipe Pin
AndyASPVB11-Aug-09 9:18
AndyASPVB11-Aug-09 9:18 
AnswerRe: Some Help on how to assign a Web Service to a NamedPipe Pin
eggsovereasy11-Aug-09 11:36
eggsovereasy11-Aug-09 11:36 
GeneralRe: Some Help on how to assign a Web Service to a NamedPipe Pin
AndyASPVB11-Aug-09 12:01
AndyASPVB11-Aug-09 12:01 
QuestionProblem with crystal reports Pin
shylock111-Aug-09 9:02
shylock111-Aug-09 9:02 
AnswerRe: Problem with crystal reports Pin
Rahul Chitte17-Aug-09 6:01
Rahul Chitte17-Aug-09 6:01 
Questiona general question on download function Pin
Seraph_summer11-Aug-09 8:53
Seraph_summer11-Aug-09 8:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.