如何在DetailsView中查找TextBox ID?

时间:2011-10-11 19:13:20

标签: asp.net detailsview

DetailsView我没有使用TemplateFieldAutoGenerateRow=true AutoGenerateInsertButton="True"。现在我想知道如何在TextBox事件中找到DetailsView1_ItemInserting ID?

1 个答案:

答案 0 :(得分:0)

您应该可以使用DetailsView的FindControl方法

protected void DetailsView1_ItemInserting(object sender, System.Web.UI.WebControls.DetailsViewInsertEventArgs e)
    {
        var myLabel = DetailsView1.FindControl("LabelID") as Label;
        myLabel.Text = "something here";
    }