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

2 posts, 0 answers
  1. Dan
    Dan avatar
    7 posts
    Member since:
    May 2011

    Posted 02 Mar Link to this post

    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.

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1800 posts

    Posted 07 Mar Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top