hi ....
i need help to unserstand this code please
if someone can help by explain or write commant
Public Shared Function GetPostBackControl(ByVal thePage As Page) As Control
Dim myControl As Control = Nothing
'
Dim ctrlName As String = thePage.Request.Params.Get("__EVENTTARGET")
If ((ctrlName IsNot Nothing) And (ctrlName <> String.Empty)) Then
myControl = thePage.FindControl(ctrlName)
Else
For Each Item As String In thePage.Request.Form
Dim c As Control = thePage.FindControl(Item)
If (TypeOf (c) Is System.Web.UI.WebControls.Button) Then
myControl = c
End If
Next
End If
Return myControl
End Function
Protected Overrides Sub OnInit(ByVal e As EventArgs)
MyBase.OnInit(e)
dynamicTextBoxes = New TextBox(myCount - 1) {}
Dim i As Integer
For i = 0 To myCount - 1 Step i + 1
If myCount - 1 <= 3 Then
Dim textBox As TextBox = New TextBox()
textBox.ID = "myTextBox" + i.ToString()
Dim requiredfield As RequiredFieldValidator = New RequiredFieldValidator()
requiredfield.ControlToValidate = "myTextBox" + i.ToString()
requiredfield.ErrorMessage = " fill this Option"
requiredfield.ID = "myRequiredField" + i.ToString
Dim Op As LiteralControl = New LiteralControl("Option " & i + 1 & " : ")
myPlaceHolder.Controls.Add(Op)
myPlaceHolder.Controls.Add(textBox)
myPlaceHolder.Controls.Add(requiredfield)
dynamicTextBoxes(i) = textBox
Dim literalBreak As LiteralControl = New LiteralControl("<br /> <br/>")
myPlaceHolder.Controls.Add(literalBreak)
End If
Next
End Sub
thanks :$