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

How do I open a RadGrid in “Add New” mode with default values pre-filled?

1 Answer 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 02 Mar 2016, 06:45 PM

From a hyperlink I need default values to appear when a RadGrid PopUp opens in "Add New" mode. It works fine when a RadButton is clicked (CommandName="InitInsert"). For that I set defaults in the RadGrid_ItemCommand:

if (e.CommandName == RadGrid.InitInsertCommandName)
{
    e.Canceled = true;
    Hashtable values = GetDefaultValues();
    e.Item.OwnerTableView.InsertItem(values);
}

The RadGrid's MasterTableView has EditMode="PopUp". To cause the PopUp to appear from a link I've passed the text "AddNew" in the queryString. Then in PageLoad I set RadGrid.MasterTableView.IsItemInserted = true; as described here. What I can't figure out is how do I get default values to appear in the PopUp that is triggered from a hyperlink? What event? A code sample would be much appreciated.

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 07 Mar 2016, 08:24 AM
Hi Dan,

Since using a hyperlink will open a new page, you could handle the Load or PreRender Page events for performing the inserting with the default values. 

If the default values will be static, you could use the columns DefaultValue property for achieving the same behavior:
Hope this helps.


Regards,
Konstantin Dikov
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Dan
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or