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

[Solved] Databinding actions using lambda exp

2 Answers 107 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Joan Vilariño
Top achievements
Rank 2
Joan Vilariño asked on 26 May 2010, 11:07 AM

Hello...

I have my ajax grid bound like this:

.DataKeys(dk => dk.Add(o=>o.Id))  
.DataBinding(db => db.Ajax().Select("_select","myController").Update("_update","myController").blah blah blah 

myControllerController has this:

[GridAction]  
public ActionResult _select()  
{  
     return whateever...  
}  
 
[GridAction]  
public ActionResult _update(long id)  
{  
    return whatever....  

As you see _update takes the parameter of the entity's key...

I want to change Grid databinding actions to use lambdas... in the _select case is easy:

.Select<myControllerController>(o=>o._select()) 

but in the _update case, I don't know how to pass the id parameter:

.Update<myControllerController>(o=>o._update(??????))

Can you give me a way to do this? I find the code is much clearer using lambdas, and it allows refactoring within the IDE.

2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 26 May 2010, 11:28 AM
Hi Joan VilariƱo,

You should pass any integer to satisfy the compiler:

.Update<myControllerController>(o=>o._update(1))

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Joan Vilariño
Top achievements
Rank 2
answered on 27 May 2010, 02:49 PM
Thanks, that did it...

anyway, I've rolled back to the previous mode, because when I use lambdas and hen for example, edit, update, edit, update a pair of times, IE8 shows a bubble telling me that the document has caused the navigator to switch to compatibility mode, and it reloads the page.

I've confirmed this doesn't happen if you use the old Update("action","controller") way, but does it when you use .Update<MyController>(o=>o.myAction);

Any hint on this? Its kinda extrange.

Cheers
Tags
Grid
Asked by
Joan Vilariño
Top achievements
Rank 2
Answers by
Atanas Korchev
Telerik team
Joan Vilariño
Top achievements
Rank 2
Share this question
or