How to traverse TextBox (or other controls) in the web page

xiaoxiao2021-03-06  58

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 NextNext

Note: 1. Use a 2-layer loop because TextBox and other controls are subcipes for a control in Page.Controls.

2. Use the method of traversing TextBox, which can easily fill in the corresponding data in the database to the corresponding TextBox.

转载请注明原文地址:https://www.9cbs.com/read-118975.html

New Post(0)