Dim objTextBox As New TextBox For Each MainControl As Control In Page.Controls For Each objControl As Control In MainControl.Controls If objControl.GetType.ToString = "System.Web.UI.WebControls.TextBox" Then objTextBox = objControl End If Next Next 注释:1.采用2层循环,是因为Textbox及其它控件,是Page.Controls中某控件的子控件。 2.采用遍历Textbox的方法,可以很方便的把数据库中的对应数据填写到对应的Textbox中。 |