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

[Solved] Iterating Through Grid Data

1 Answer 95 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Russ
Top achievements
Rank 1
Russ asked on 24 May 2012, 08:49 PM

I need to conditionally display a link based on data in a Grid. I'm monitoring some network traffic, and only after an async request runs in the background will I know if the link needs to be displayed, so I need to control the link's visibility client-side. My thought was to use the OnDataBound event, and iterate through a couple of the column values I need, compare them, and show() or hide() the link accordingly. I can get a handle on the grid using var grid = $("#MyGrid").data("tGrid");. Beyond that, I've tried several approaches finding the table row, column, dataItem, etc., but I can't seem to get at the actual data. Is there an example available or a better approach? Thanks.

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 29 May 2012, 09:15 AM
Hello Russ,

You can get all the data of the Grid through the data field exposed by the Grid client object.
e.g.
$('#Grid').data('tGrid').data
Also make sure that you are using fully Ajax binding - otherwise (for example if you initially populate the Grid on the server) the data field will return null instead of the array holding the objects.

All the best,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
Tags
General Discussions
Asked by
Russ
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or