format a string in Data Repeater (list array as a data source)
-
Hi I have a repeater control and I used array list as the data source. This array has only one field and it's a number to be used as the identification. how can i format the image server control url in my data repeater to show the right image with right Id! thank you so much Here is my source code:
List lstID = new List(); var query2 = context.Offers.Select(p => new { itemId = p.OfferId }).Skip(1).Take(6).ToList(); foreach (var item in query2) { lstID.Add(item.itemId); } RepeaterOthers.DataSource = lstID; RepeaterOthers.DataBind();
and here is where i'd like to use that offerId: <asp:Repeater ID="RepeaterOthers" runat="server"> <ItemTemplate> <asp:Image ID="ImageFront" runat="server" ImageUrl="~/images/{0}.jpg" /> </ItemTemplate> </asp:Repeater>
-
Hi I have a repeater control and I used array list as the data source. This array has only one field and it's a number to be used as the identification. how can i format the image server control url in my data repeater to show the right image with right Id! thank you so much Here is my source code:
List lstID = new List(); var query2 = context.Offers.Select(p => new { itemId = p.OfferId }).Skip(1).Take(6).ToList(); foreach (var item in query2) { lstID.Add(item.itemId); } RepeaterOthers.DataSource = lstID; RepeaterOthers.DataBind();
and here is where i'd like to use that offerId: <asp:Repeater ID="RepeaterOthers" runat="server"> <ItemTemplate> <asp:Image ID="ImageFront" runat="server" ImageUrl="~/images/{0}.jpg" /> </ItemTemplate> </asp:Repeater>
I haven't tested but this should be work. If doesn't work the let me know. Thanks
Parwej Ahamad
-
I haven't tested but this should be work. If doesn't work the let me know. Thanks
Parwej Ahamad
thank u so much man! it worked! recently i lost my old projects files that i programmed before now i know nothing without it! lol
-
thank u so much man! it worked! recently i lost my old projects files that i programmed before now i know nothing without it! lol
Your Welcome!
Parwej Ahamad