I am trying to make a grid of thumbnails using a datalist. I have an array of the imageurls and I want to bind them in the code behind. How would I go about do that? I want the datalist to have a max column size of 5 and add rows of thumbnails until completed.
<asp:DataList ID='dlImages' runat='server' RepeatColumns='5' RepeatDirection='Horizontal' RepeatLayout='Flow'> <ItemTemplate> <asp:Image ID='imgStore' runat='server' /> </ItemTemplate> </asp:DataList>
CODEBEHIND:
protected void BindImages(string[] imageurls) { for (int i = 0; i < imageurls.Length; i++) { . . . } }
I think this will do it for you
Code behind
You might also be able to do
But sometimes server controls don’t like render blocks in them.