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

[Solved] Set a DefaultValue from ViewModel

1 Answer 27 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.
David
Top achievements
Rank 1
David asked on 22 Jun 2012, 08:25 AM
Hello telerik-community:)

i just started to develop with the telerik controls.

i've got a question:
how can i set a column with a default value of my ViewModel but another property than the binded to the Grid.
i'd like to insert a column with a value of "Model.OtherPropertyThanGridViewModelList".

e.g.:
@(Html.Telerik().Grid(Model.GridViewModelList)
                .Name("Grid")
                .ToolBar(cmd => cmd.Insert())
                .DataKeys(keys => keys.Add(c => c.ID))
                .DataBinding(dataBinding => dataBinding
                       .Ajax()
                        .Select("Selecting", "Kurs", new {KursId = Model.Kurs.ID })
                                .Insert("Inserting", "Kurs")
                                .Update("Updating", "Kurs")
                                .Delete("Deleting", "Kurs"))
                .Columns(c =>
                    {
                        c.ForeignKey(o => o.KursId, (IEnumerable)Model.Kurs.ID);
                        c.Bound(o => o.Datum);
                        c.Bound(o => o.StartZeit);
                        c.Bound(o => o.EndZeit);
                        c.Bound(Model.Kurs.ID);
                        c.Command(cmd =>
                            {
                                cmd.Edit();
                                cmd.Delete();
                            });
                    })
              )
best regards

1 Answer, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
answered on 22 Jun 2012, 09:07 AM
ooops!

i solved it with
.Select("Selecting", "Controller", new {Id= Model.OtherProp.ID })
.Insert("Inserting", "Controller", new {Id= Model.OtherProp.ID })
 
Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Share this question
or