c# - ASP.Repeater getting and setting -


i have following asp:repeater setup:

<asp:repeater runat="server" id="articleinforepeater">     <itemtemplate>         <div class="col-md-9" style="margin-top: 30px;">             <h2><%#: eval("title") %></h2>             <div style="margin-top:10px;">                 <%#: eval("content") %>             </div>         </div>     </itemtemplate>  </asp:repeater> 

and want populate using list<> returned when item select list selected.

my problem is, how set eval value. have seen question understanding asp.net eval() , bind() case have create whole new class set these 2 simple values? know simple task, seems rather drastic set 2 variables.

if not, how set these 2 values? list trying use populate fields has properties corresponding name of eval field.

i assume after use loop populate them? guess need command make populate field, or assignment of eval value automatically populate field each time?

there no clear instructions on how achieve goal, think simple , straight forward goal.

what want do, build model of data.

public class example {      public int id { get; set; }      public string title { get; set; }      public string content { get; set; } } 

now have model, call database. populate list<example>, return you. once have list<example> do:

list<example> content = populatelistexample(); articleinforepeater.datasource = content; articleinforepeater.databind(); 

then on front end reference properties, <%# eval("title") %> , reference enumerable source.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -