It appears that I have been using asp.net databinding for so long I have forgotten some of the basics.
I am dynamically creating a table in an ASPX page without dat
You can pass the parameters by query string.
something like this :
foreach (XXX x in TTTT){ %>
<tr>
<td><%=x.val %></td>
<a href='?Action=Resolve&pkid=<%=X.pkid%>'>
<img src='../images/IMG.png' />
</a>
<% } %>
I'd suggest a listview control. Something like this:
<asp:ListView ID="lvImages" runat="server" OnItemDataBound="lvImages_ItemDataBound">
<LayoutTemplate>
<table class="tblImages" cellpadding="0" cellspacing="0">
<tr class="ImageHeaderRow">
<td>Imagename</td>
<td>Image</td>
<td>Location</td>
</tr>
<asp:PlaceHolder ID="itemContainer" runat="server"></asp:PlaceHolder>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<asp:literal ID="ltrCell1" runat="server" />
<td><asp:ImageButton ID="imgMyImage" runat="server" /></td>
<td><asp:Label ID="lblLocation" runat="server" ></asp:Label></td>
</tr>
</ItemTemplate>
</asp:ListView>
Code behind :
protected void lvImages_ItemDataBound(object sender, ListViewItemEventArgs e) {
if (e.Item.ItemType == ListViewItemType.DataItem) {
ListViewDataItem currentItem = (ListViewDataItem)e.Item;
MyImageObject oImg = (MyImageObject)currentItem.DataItem;
Literal ltrCell1 = e.Item.FindControl("ltrCell1") as Literal;
ImageButton imgMyImage = e.Item.FindControl("imgMyImage") as ImageButton ;
Label lblLocation= e.Item.FindControl("lblLocation") as Label;
ltrCell1.text = string.format(@"<td id=""{0}"">{1}</td>", oImg.id, oImg.val);
imgMyImage.CommandArgument = oImg.arg;
imgMyImage.CommandName = "cmdNAme";
imgMyImage.ImageUrl = oImg.URL;
}
BEst of Luck!