This is a migrated thread and some comments may be shown as answers.

Referring to dynamically created grid in item command handler

2 Answers 43 Views
Grid
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 24 Nov 2008, 06:19 PM
Hi. I have a grid that is being created entirely in the code behind, and I need to refer to it in the item command handler. Is there a way that I can make something like this work?:

Public

 

Sub EmployeesGrid_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles

 

EmployeesGrid.ItemCommand

 


variable = EmployeesGrid.Items(rowIndex 1)("column").Text
EmployeesGrid.Rebind()

End
Sub

 

 

 

When the grid is created statically this code isn't a problem, but when it's created programmatically, I get an object not set to an instance of an object error.

2 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Top achievements
Rank 1
answered on 24 Nov 2008, 06:56 PM
Hi William,

You can get reference to the grid using the sender argument in the event handler.

Vlad
0
William
Top achievements
Rank 1
answered on 24 Nov 2008, 10:46 PM
Vlad,

Great! That's what I was looking for. I was able to use:

Dim

 

grid As RadGrid = sender

 

grid.Rebind()
Thanks a lot,
William

Tags
Grid
Asked by
William
Top achievements
Rank 1
Answers by
Vlad
Top achievements
Rank 1
William
Top achievements
Rank 1
Share this question
or