how to display image in repeater after AJAX AsyncFileUpload ?
Posted
by Gordon Shamway
on Stack Overflow
See other posts from Stack Overflow
or by Gordon Shamway
Published on 2010-05-04T05:15:44Z
Indexed on
2010/05/04
5:28 UTC
Read the original article
Hit count: 592
ASP.NET
Hello
i am using the AsyncFileUpload from the ajaxtoolkit, upter the upload is complete ,
i want to display all the images that were uploaded (and their URL is inserted into the DB) with my repeater and binding method.
but its not working! the images are uploaded, the DB insert works file, but i cant see the images after the repeater is dinded.
(i have to mention that if i go step by step, i do see that the ITEMBOUND is being binded and executed)
<ajax:TabContainer runat="server" ID="testTab">
<ajax:TabPanel runat="server" ID="testTabContainer">
<ContentTemplate>
<ajax:AsyncFileUpload ID="uploadAsyncImage" runat="server" OnUploadedComplete="InsertToTemp" ThrobberID="Throbber"/>
<asp:Label ID="Throbber" runat="server" Style="display: none">
<img src="Images/indicator.gif" align="absmiddle" alt="loading" />
</asp:Label>
<br />
<asp:UpdatePanel runat="server" ID="pnlImages" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<asp:Repeater runat="server" ID="rptImages" >
<ItemTemplate>
<a href="<%# DataBinder.Eval(Container.DataItem, "PicURL")%>" rel="lightbox">
<asp:Image ImageUrl='<%# DataBinder.Eval(Container.DataItem, "PicURL")%>' Width="50" Height="50" runat="server" ID="testPic" />
</a>
</ItemTemplate>
</asp:Repeater>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</ajax:TabPanel>
</ajax:TabContainer>
</form>
also adding my Code Behind, since it might be important or will help you get an idea of what i am trying to do.private void BindRepater() { ProjDataContext db = DbContext.DbContextProvider(); var pic = from p in db.TempProdCats where p.SessionID == Session.SessionID.ToString() select new { PicURL = p.PicURL };
rptImages.DataSource = pic;
rptImages.DataBind();
pnlImages.Update();
}
protected void rptImages_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Image lblCat = (Image)e.Item.FindControl("testPic");
lblCat.ImageUrl = (string)DataBinder.Eval(e.Item.DataItem, "PicURL");
pnlImages.Update();
}
}
your help will be highly appreciated , if any of you got any idea how to make it work...
© Stack Overflow or respective owner