asprepeater - Binding Data to server controls in asp:repeater -


i have repeater control bound method , display result list of linkbuttons, can't head around it. i've tried:

in asp page have:

<asp:repeater id="resultcountrepeater" runat="server" visible="false" >                             <itemtemplate>                                 <asp:linkbutton id="userresultcount" runat="server" onclick="userresultcount_click" text="<%# databinder.eval(container.dataitem,"text") %>" >                                 </asp:linkbutton>                             </itemtemplate>                         </asp:repeater> 

and in code behind:

list<listitem> resultcountlist = new list<listitem>();                 foreach (isearchengine oneeng in engines)                 {                     listitem item = new listitem();                     item.text = oneeng.obectname();                     item.value = convert.tostring(oneeng.pagecount(searchwords, townid));                     resultcountlist.add(item);                 }                 resultcountrepeater.datasource = resultcountlist;                 resultcountrepeater.databind(); 

unfortunately giving me compile error: server tag not formed.

any ideas wrong?

thanks

use single quotes dynamically set properties.

<asp:linkbutton id="userresultcount" runat="server" onclick="userresultcount_click" text="<%# databinder.eval(container.dataitem,"text") %>" ></asp:linkbutton> 

should

<asp:linkbutton id="userresultcount" runat="server" onclick="userresultcount_click" text='<%# databinder.eval(container.dataitem,"text") %>' ></asp:linkbutton> 

Comments