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

RadGrid get_gridDataItem() hookup ?

5 Answers 303 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Paul Black
Top achievements
Rank 1
Paul Black asked on 22 Sep 2008, 10:58 AM
I want to use the get_gridDataItem method on a dblclick row event.  How do I 'hookup' the create/created events?

""get_gridDataItem() is not directly available on the client unless OnRowCreating/OnRowCreated events are hooked up.""

Thanks

5 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 22 Sep 2008, 11:03 AM
Hello Paul,

You handle these events in exactly the same way as OnRowDblClick.

All the best,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Paul Black
Top achievements
Rank 1
answered on 22 Sep 2008, 12:40 PM
No sorry I wasn't clear.  I am already handling the DBlCLick event via javascript and I want to access some of the row column data.  The documents say thet I can't access get_gridDataItem unless I also wire up the onCreate/etc  as the method I want won't be available until I do.  Please advise.
0
Vlad
Telerik team
answered on 22 Sep 2008, 12:42 PM
Hi Paul,

All you need is to attach event handler for OnRowCreated client-side event:

<ClientSettings>
 <ClientEvents OnRowCreated="MyRowCreated" ...

function MyRowCreated(sender, args)
{
   
}

Regards,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Paul Black
Top achievements
Rank 1
answered on 22 Sep 2008, 01:01 PM
Hi there,
thanks for the quick reply.  However still no joy...

here is my simple test...

<

telerik:RadScriptBlock ID="gridScripts" runat="server">

<

script>

function

RowDblClick(sender,eventArgs) {

var

o = eventArgs.get_gridDataItem();

var

p = o.get_dataItem();

var

client= p["ClientName"];

alert('!'+client);

}function RowCreated(sender,args) {}</script></telerik:RadScriptBlock>

The javascript fails on o.get_dataItem();
The above was adapted  from the telerik documentation see below

http://www.telerik.com/help/aspnet-ajax/grid-get-data-item.html


"""
 function RadGrid1_RowDataBound(sender, args)
  {
     //extracts the employee name (from column with unique name "EmployeeName") of the currently bound grid item
     var employeeName= eventArgs.get_gridDataItem().get_dataItem()["EmployeeName"]; 
  } 
"""

0
Vlad
Telerik team
answered on 22 Sep 2008, 01:19 PM
Hello Paul,

You do not need all grid data items to achieve this. I have attached small example to illustrate you how to achieve your goal.

Regards,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
Paul Black
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Paul Black
Top achievements
Rank 1
Share this question
or