源代码:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim tRow As New TableRow()
Dim tCell As New TableCell()
Dim TextBox1 As New TextBox()
tCell = New TableCell()
TextBox1 = New TextBox()
TextBox1.ID = "WellName"
TextBox1.Width = 100
TextBox1.Text = "WellName"
tCell.Controls.Add(TextBox1)
tRow.Cells.Add(tCell)
BedData.Rows.Add(tRow)
Else
Dim MyControl As Control = BedData.FindControl("WellName")
If (Not MyControl Is Nothing) Then
Dim WellName As String = MyControl.ToString
Else
Response.Write("没找到")
End If
End If
End Sub
其中:BedData为Table控件
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim tRow As New TableRow()
Dim tCell As New TableCell()
Dim TextBox1 As New TextBox()
tCell = New TableCell()
TextBox1 = New TextBox()
TextBox1.ID = "WellName"
TextBox1.Width = 100
TextBox1.Text = "WellName"
tCell.Controls.Add(TextBox1)
tRow.Cells.Add(tCell)
BedData.Rows.Add(tRow)
Else
Dim MyControl As Control = BedData.FindControl("WellName")
If (Not MyControl Is Nothing) Then
Dim WellName As String = MyControl.ToString
Else
Response.Write("没找到")
End If
End If
End Sub
其中:BedData为Table控件
解决方案 »
- 两个弹出窗口的刷新问题
- 关于数据传值的问题
- 大哥大姐们帮帮忙
- sql2005示例数据库AdventureWork下载
- |M| 请问有谁有过 [动软.Net代码自动生成器] 的CodematicDemo 有几个问题请问大家
- 如何实现水晶报表rpt文件分页?
- 请教:怎样使ImageButton先执行javascript函数后调用后台的click函数?
- 异常详细信息: System.FormatException: 输入字符串的格式不正确。
- 关于ASP.NET的AJAX扩展
- 我是初学asp.net的,我想问老师们几个问题
- 求救,验证视图状态 MAC 失败。
- 高手朋友们帮忙!ASP.NET中关于如何将绝对路径转换成虚拟路径的问题
Dim tRow As New TableRow()
Dim tCell As New TableCell()
Dim TextBox1 As New TextBox()
tCell = New TableCell()
TextBox1 = New TextBox()
TextBox1.ID = "WellName"
TextBox1.Width = 100
TextBox1.Text = "WellName"
tCell.Controls.Add(TextBox1)
tRow.Cells.Add(tCell)
BedData.Rows.Add(tRow)
Dim MyControl As Control = BedData.FindControl("WellName")
If (Not MyControl Is Nothing) Then
Dim WellName As String = MyControl.ToString
Else
Response.Write("没找到")
End If
End Sub
Dim tRow As New TableRow()
Dim tCell As New TableCell()
Dim TextBox1 As New TextBox()
tCell = New TableCell()
TextBox1 = New TextBox()
TextBox1.ID = "WellName"
TextBox1.Width = 100
TextBox1.Text = "WellName"
tCell.Controls.Add(TextBox1)
tRow.Cells.Add(tCell)
BedData.Rows.Add(tRow)
Dim MyText As TextBox = CType(BedData.FindControl("WellName"), TextBox)
If (Not MyText Is Nothing) Then
Response.Write(MyText.Text)'这里取到的是默认值,和用户输入文本框的数据不一致,因为这时VIEWSTATE还没把值赋给文本框
Else
Response.Write("没找到")
End If
End Sub