c# - How do I bind a string array(list of files in my case) to a variable in the item template of a repeater? -


how bind string array(list of files in case) variable in item template?

here have far not sure code behind itemdatabound.

i trying put each url in <% photo_url %> variable.

any appreciated.

thanks in advanced.

page code

<asp:repeater id="unorderedlist" runat="server" onitemdatabound="unorderedlist_itemdatabound">    <headertemplate>        <ul class="thumbs noscript">    </headertemplate>    <itemtemplate>           <li>             <a class="thumb" href='<%# photo_url %>'>                 <img src='<%# photo_url %>'>             </a>             <div class="caption">                 <div class="download">                     <a href='<%# photo_url %>'>download original</a>                 </div>             </div>         </li>    </itemtemplate>    <footertemplate>        </ul>    </footertemplate> </asp:repeater> 

code behind

private void page_init(object sender, eventargs e) {     string[] photos = directory.getfiles(imageslocation);     unorderedlist.datasource = photos;     unorderedlist.databind(); } protected void unorderedlist_itemdatabound(object sender, repeateritemeventargs e) {     //what goes here } 

            <div class="download">                 <a href='<%# container.dataitem %>'>download original</a>             </div> 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -