Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding controls to a datatable

Status
Not open for further replies.

wrexhamafc234

Programmer
Oct 23, 2006
18
GB
Hello, im creating a datatable and in one of the columns, i woul like to add a control (image).

Code:
DataTable alerttable = new DataTable("alerttable");
        alerttable.Columns.Add("Priority");

                    if ((string)Priority == "High")
                    {
                        Priority = "<img src='./images/priority/high.gif' border=0>";
                        image.ImageUrl = "./images/priority/high.gif";
                        prioritycell.Controls.Add(image);
                    }
                    else if ((string)Priority == "Medium")
                    {
                        Priority = "<img src='./images/priority/high.gif' border=0>";
                        image.ImageUrl = "./images/priority/medium.gif";
                        prioritycell.Controls.Add(image);
                    }
                    else if ((string)Priority == "Low")
                    {
                        Priority = "<img src='./images/priority/high.gif' border=0>";
                        image.ImageUrl = "./images/priority/low.gif";
                        prioritycell.Controls.Add(image);
                    }

alerttable.Rows.Add(image);

When I try to add the image into the datatable (as shown above), all that is outputted into the table is the following: 'System.Web.UI.WebControls.Image'

Any way of actually adding a control to a datatable?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top