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

[Solved] Parameter for generic DataBinding Actions

3 Answers 91 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.
Frank Michael
Top achievements
Rank 1
Frank Michael asked on 04 May 2010, 07:28 PM
I can't figure out how I can provide the necessary id parameter for the .Delete<SprintController>(sc=>sc.AjaxGridDelete(id)) and .Update method.
I can't just leave it blank like with .Delete("AjaxGridDelete","Sprint") because it is syntax checked.
Html.Telerik().Grid<RenderSprint>() 
        .BindTo(Model) 
        .Name("SprintGrid") 
        .Localizable("de-DE") //ToDo Culture allgemein ersetzen 
        // .Selectable() // - nett aber nutzlos.  
        .ToolBar(tb => {  
            tb.Insert(); 
            tb.Custom().Action<SprintController>(sc => sc.Aggregate()).Text("Aggregate"); // ToDo hier muss ich Ajax machen.   
        }) 
        .DataBinding(b => b.Ajax() 
            .Select<SprintController>(sc => sc.AjaxGridSelect()) 
            //ToDo .Delete<SprintController>(sc => sc.AjaxGridDelete()) 
            .Delete("AjaxGridDelete", "Sprint") 
            .Insert<SprintController>(sc => sc.AjaxGridInsert()) 
            // ToDo .Update<SprintController>(sc => sc.AjaxGridUpdate())) 
            .Update("AjaxGridUpdate", "Sprint")) 

3 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 05 May 2010, 07:38 AM
Hello Frank Michael ,

You just need to pass the required value to the action method:

.Select<SprintController>(sc => sc.AjaxGridSelect(5))

We need more information about your scenario in order to provide a complete solution.

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
Frank Michael
Top achievements
Rank 1
answered on 05 May 2010, 10:21 AM
It is clear that I need to pass a parameter.
But where should I get it from?
It is the key of the row.
I declared
.DataKeys(k => k.Add(s => s.RowKey)) 
So I should expect that it is possible somehow to access this key, but I do not know how.

A workaround could be to add an invisible column with the key, But then I do not know how I could access the cell content as well.
0
Accepted
Atanas Korchev
Telerik team
answered on 05 May 2010, 10:50 AM
Hello Frank Michael ,

You cannot access the underlying object when defining the action methods. Since the keys are automatically added you can use a dummy value for the parameter in order to satisfy the compiler e.g.:

.Select<SprintController>(sc => sc.AjaxGridSelect(5))

The other option is not to use the generic methods but the string based ones.

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.
Tags
Grid
Asked by
Frank Michael
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Frank Michael
Top achievements
Rank 1
Share this question
or