TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
monica singh
NA
15
7.5k
to Display list<string> in repeator inside data list control
Feb 5 2016 3:13 AM
hello I have a session variable "question" whose fields are of type string ques , string qtype, list
correctans, list
yourans.
now i have to display the question with all values,
i have pased question through session variable , in datalist control, but since two fields are of list , it is giving error,
can you plz guide how should i display a question in datalist with list
type field.
C# Code
exam = (Examination)Session["questions"];
Examination exam = (Examination)Session["Question"];
DataList1.DataSource = exam.questions;
DataList1.DataSource = exam.questions;
DataList1.DataBind();
aspx page
<asp:DataList ID="DataList1" runat="server" Width="100%">
<HeaderTemplate>
<a href="showresult.aspx">Show Result</a>
<h2>Review Questions</h2>
<hr size="5" style="color: red" />
</HeaderTemplate>
<ItemTemplate>
<pre style="color: Red; background-color: #eeeeee"><%# DataBinder.Eval( Container.DataItem,"QuestionText")%></pre>
<pre>1.<%# DataBinder.Eval( Container.DataItem,"Answer1") %></pre>
<pre>2.<%# DataBinder.Eval( Container.DataItem,"Answer2") %></pre>
<pre>3.<%# DataBinder.Eval( Container.DataItem,"Answer3") %></pre>
<pre>4.<%# DataBinder.Eval( Container.DataItem,"Answer4") %></pre>
</ItemTemplate>
<ItemTemplate>
<pre>Correct Answer :</pre>
<asp:Repeater ID="Repeater1" runat="server" >
<ItemTemplate>
<span><%# DataBinder.Eval( Container.DataItem,"cans") %></span>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
<SeparatorTemplate>
<hr size="2" style="color: Red" />
</SeparatorTemplate>
<FooterTemplate>
<hr size="5" style="color: red" />
<a href="showresult.aspx">Show Result</a>
</FooterTemplate>
</asp:DataList>
Reply
Answers (
2
)
on button click check box validate in datalist
Use Oracle View Objects in MVC Application by Dapper