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

[Solved] Inserting new row with default values

4 Answers 146 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Virendra
Top achievements
Rank 1
Virendra asked on 07 May 2009, 09:39 AM
Hi,

Is there a way to insert new row with default values?
When i hit <Insert>, i want new row to come with default values.

Thanks
virendra

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 07 May 2009, 10:30 AM
Hi Virendra,

You can use AddingNewDataItem event to achieve this. Please check this demo for more info:
http://demos.telerik.com/silverlight/#GridView/DataUpdates

All the best,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Virendra
Top achievements
Rank 1
answered on 07 May 2009, 11:03 AM
Thanks Vlad,

I saw the demo and was trying to do the similar implementaion but it didn't work for me.
In my application have IList<object> which i bind to ItemSource and in event handler i have this code..
public void GVDataGrid_AddingNewDataItem(object sender, GridViewAddingNewEventArgs e)
{
IList<object> gridViewItemsList = new List<object>();
gridViewItemsList.Add((100).ToString());
gridViewItemsList.Add("ABCD");
gridViewItemsList.Add("USA");
gridViewItemsList.Add("SF");
gridViewItemsList.Add("1/1/2009");
gridViewItemsList.Add(false);
gridViewItemsList.Add("");

e. gridViewItemsList = "11111";
}

Am i missing something? my new row is comming with empty cells.

Thanks
virendra
0
Vlad
Telerik team
answered on 08 May 2009, 07:17 AM
Hi Virendra,

The grid cannot map list of objects to property names/values - you will need to use strongly type classes to achieve your goal.

Sincerely yours,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Virendra
Top achievements
Rank 1
answered on 12 Nov 2009, 06:54 AM
Hi,

I am using now Q2, 2009 release but my question is same, 
How to do it in new release?

thanks
virendra
Tags
GridView
Asked by
Virendra
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Virendra
Top achievements
Rank 1
Share this question
or