asp.net中怎么删除自动生成的label控件的值
public void NewLabel(string value, string columnname)
{
Label lab = new Label();
lab.ID = columnname + 1;
lab.Text = value;
lab.Visible = true;
this.myID.Controls.Add(lab);
LinkButton labclose = new LinkButton();
labclose.ID = columnname + 2;
labclose.Text = "×";
labclose.Style.Add("color", "red");
this.myID.Controls.Add(labclose);
labclose.Click += new EventHandler(labclose_click); //关闭
}
同时生成Label和LinkButton 两个控件,,怎么在点击LinkButton X这个控件的时候清空label控件 的值
[解决办法]
Labe lbl =myID.FindControl(columnname + 1) as Label
if(lbl!=null)
lbl.Text="";