Question

Do you know how to access textboxes added to a radgrid that are not bound but are used to trap any row related input a user typed in to the textbox for that column. I need to access this data server side when a postback occurs. Your thoughts are greatly appreciated Thanking you

Tony

Was it helpful?

Solution

That depends on how those textboxes are being added/created. If by 'not bound' you mean they are in Template columns you should be able to use .FindControl in one of the grid's events to grab that textbox. And again which event will depend on what is causing the postback to happen. For the purpose of this code example I'll assume you are dealing with a Command item on the 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 that helps.

OTHER TIPS

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top