I use the following code to work with every row in my table after binding:
protected void dtlImages_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item)
{
LinkButton button = (LinkButton)e.Item.FindControl("lbDeleteImage");
button.Visible = false;
}
}
I have a button next to each image in the table that allows me to delete the image (row). It seems to work fine, but what really happens is that it makes invisible any element of the row (delete button). What can happen? It's hard to find the right words to search on Google. :)
If you saw my table, it will look like a beautiful list of images with a description and image, as well as every other line with a delete button next to the image. In this simple example (I clarified the conditions for clarity), they should all disappear, I would think.
Any suggestions?
source