asprepeater - Getting the id of a repeater field in asp.net -
i faceing problem. have image view contains repeater. want when last image shown site needs redirected dont know how current field shown. thinking make variable holds current id , compare every time new image shown. , if new images id lower 1 in other variable has redirect.
at moment dont have code post because don know how solve this. hope of can help.
this code repeater on html site
<div id="imgback" runat="server" class="row" style="background-color: black;"> <div class="col-lg-12"> <div class="container"> <div class="fotorama" data-arrows="false" data-maxheight="750" data-allowfullscreen="native" data-loop="false" data-ratio="1024/750" data-nav="false" data-autoplay="5000" data-click="false" data-swipe="false" data-stopautoplayontouch="false" data-transition="crossfade" data-shuffle="true" data-fit="contain"> <asp:repeater id="repimgs" runat="server" onitemdatabound="repimgs_itemdatabound"> <itemtemplate> <asp:image id="imgs" imageurl='<%# string.format("~/images/{0}", eval("filename")) %>' runat="server" /> </itemtemplate> </asp:repeater> </div> </div> </div> </div>
and here got on end far
protected void repimgs_itemdatabound(object sender, repeateritemeventargs e) { if (e.item.itemtype == listitemtype.item || e.item.itemtype == listitemtype.alternatingitem) { if (e.item.itemindex == repimgs.items.count - 1) { response.redirect("finishedsession.aspx"); } } }
to last item in repeater use itemdatabound
protected void myrepeater_itemdatabound(object sender, repeateritemeventargs e) { if (e.item.itemtype == listitemtype.item || e.item.itemtype == listitemtype.alternatingitem) { if (e.item.itemindex == myrepeater.items.count - 1) { // } } }
Comments
Post a Comment