tags:

views:

24

answers:

1

I'm making a table with data, and the last column needs to be have a recycle-bin icon for each row, allowing me to delete that row. Problem is, I can't find this icon or how to add it.

This is an <asp:Table> Web Control and I'm adding rows and cells via the C# file behind it.

I'm thinking of using something like:

TableCell cell = new TableCell();
cell.

And that's where I'm stuck. I need to have the cell contain that clickable recycle-bin icon, but I don't know how to add it.

A: 

Unless i'm missing something, can you not just add an Image to the cell?

Or you can set the HTML of the TableCell directly via the Text property:

string recycleBinImage = "<img src='/Images/recycle_bin.jpg' alt=''>";
TableCell cell = new TableCell();
cell.Text = recycleBinImage;
row.Controls.Add(cell);

OR

Image recycleBinImage = new Image();
recycleBinImage.ImageUrl = "/Images/recycle_bin.jpg";
cell.Controls.Add(recyleBinImage);
row.Controls.Add(cell);

Then if you want to "delete" something, just add the "onclick" attribute:

recycleBinImage.Attributes.Add("onclick", "someFunctionWhichDeletes();");
RPM1984
I'm not talking about an icon that I download from some online library. I'm talking about the built-in icons that Windows has.
WebDevHobo
AFAIK the windows icon are compiled into a DLL, which cannot be easily "uncompiled". Just go to Google Images, filter by size - Icon, and type in Recycle Bin. The exact same Windows ones are there - just grab it and use it.
RPM1984
It's kinda like a menustrip. When you make a C# solution and add a menustrip to your form, you can select "insert standard items". When done, several items appear, with icons next to them. But I've checked that and it's something entirely different.
WebDevHobo
@WebDevHobo There's no equivalent facility for ASP.NET. As RPM1984 says, you'll need to find an icon file on the web and use that.
PhilPursglove
I shall do that then. Wanted to explore the options first.
WebDevHobo