Unable to find control in calendar |
| Kevin Le posted at 09-May-08 12:36 |
Hi, I am trying to find the control for a dynamic text box which is created in side a calendar but it 's always give me error. Please help. My dead line for this project is comming. Thanks
Here is my code:
Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents Calendar1 As System.Web.UI.WebControls.Calendar
Public dynamicTb As TextBox
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Dim i As Integer
Public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
i = 0
End Sub
Public Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar1.DayRender
i = i + 1 dynamicTb = New TextBox() dynamicTb.ID = i dynamicTb.Text = "hello " & i e.Cell.Controls.Add(dynamicTb)
End Sub
Public Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged
Dim tb1 As TextBox tb1 = CType(Me.FindControl(1), TextBox) //this line give me error???? Please help
End Sub
End Class
|
|