views:

3574

answers:

2

Hi There 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

A: 

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.

Corey Downie
A: 

Thanks a lot, it helped me.

Suraj Shrestha