当前位置: 代码迷 >> ASP.NET >> 怎么获取FormView模版中控件的值
  详细解决方案

怎么获取FormView模版中控件的值

热度:3207   发布时间:2013-02-25 00:00:00.0
如何获取FormView模版中控件的值
我是ASP.net的初学者,我想知道如何获取DetailsView或者是FormView中模版中某一个控件的值.

------解决方案--------------------------------------------------------
((TextBox)FormViewID.FindControl("TextBoxID")).Text = ((Calendar)FormViewID.FindControl("CalendarID")).SelectedDate.ToString();

太长了:
TextBox TextBoxID = FormViewID.FindControl("TextBoxID") as TextBox;
Calendar CalendarID = FormViewID.FindControl("CalendarID") as Calendar;
TextBoxID.Text = CalendarID.SelectedDate.ToString();