Accessing TextBox column in RadGrid by Telerik
Do you know how to refer to text fields added to a radgrid that are not anchored but are used to trap any row-related input from the user entered into the text field for that column. I need to access this data server side when postback occurs. Your thoughts are greatly appreciated Thank you
Tony
0
source to share
2 answers
It depends on how these text boxes are added / created. If "unrelated" you mean they are in the "Templates" columns, you should be able to use .FindControl on one of the grid events to capture that text field. Again, which event will depend on what triggers the postback. For this code example, let's assume you are dealing with a Command element in a grid
Private Sub radGrid_ItemCommand(ByVal source As Object, ByVal e As Telerik.WebControls.GridCommandEventArgs) Handles RadGrid1.ItemCommand
Select Case e.CommandName
Case "Update"
Dim txt as Textbox
txt = e.Item.FindControl("textboxID")
If Not txt is Nothing Then someObject.someString = txt.Text
Case Else
'do something else
End Sub
Hope it helps.
0
source to share
Private Sub radGrid_ItemCommand(ByVal source As Object, ByVal e As Telerik.WebControls.GridCommandEventArgs) Handles RadGrid1.ItemCommand
Select Case e.CommandName
Case "Update"
Dim txt as Textbox
txt = e.Item.FindControl("textboxID")
If Not txt is Nothing Then someObject.someString = txt.Text
Case Else
'do something else
End Sub
0
source to share