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

[Solved] Inserting a new record in grid

2 Answers 86 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.
Howard
Top achievements
Rank 1
Howard asked on 22 Dec 2011, 02:31 AM
Hi Telerik Team,

I've got a grid with in-line editing and an add new button in the grid header as in http://demos.telerik.com/aspnet-mvc/grid/editingajax.
When i click on add new button, it creates a new line in the grid. Is there a way that I can default some values in the textboxes like current datetime or the person's name who is logged in?

Thank you

2 Answers, 1 is accepted

Sort by
0
Accepted
Petur Subev
Telerik team
answered on 22 Dec 2011, 03:03 PM
Hello Niroj,

The setting you are looking for, can be found in the editing configuration. There is a method called DefaultDataItem - it accepts the an instance of your object containing the desired default values.
e.g.

.Editable(editing => editing.Mode(GridEditMode.InLine)
                    .DefaultDataItem(new YourModel{ Id=66,Name='Niroj'))

 
Regards,
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
0
Howard
Top achievements
Rank 1
answered on 22 Dec 2011, 11:38 PM
genius !!!

Thanks heaps
Tags
Grid
Asked by
Howard
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Howard
Top achievements
Rank 1
Share this question
or