How do i remove dynamically generated HtmlGenericControls from my Webform(asp.net c#)?

bigkid

New member
System.Web.UI.HtmlControls.HtmlGenericControl itemdiv = new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
itemdiv.ID = "NewDiv";

itemdiv.InnerHtml = "" +
"<table width=\"100%\"><tr>" +
"<td width=\"75%\"><a class =\"StandardLinks\"href=\"ViewItem.aspx?itemid=" + Itemid + "\">" + Name + "</a><br></br>" +
"Posted by:" + Userid + "</td>" +
"<td style=\"text-align: right\">Price:" + Price + "</td>" +
"</tr></table>";

this.Cell2.Controls.Add(itemdiv);

I want to dynamically remove the added control in the button click event...Please help.
 
Back
Top