External LinkButton

5 posts, 0 answers
  1. Ian
    Ian avatar
    129 posts
    Member since:
    Jun 2009

    Posted 27 Jul 2010 Link to this post

    Hi. Is there any way that I can get a LinkButton that's on the same page as a Grid to generate an 'InitInsert' command so that a new grid row can be entered by a user? For UI design reasons, I'm not able to include the LinkButton within a Grid CommandItemTemplate - it needs to be a separate LinkButton that's located in the page sidebar.
    Regards.
  2. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 27 Jul 2010 Link to this post

    Hello Ian,

    You could put the RadGrid in insert mode using the InitInsert method:
    protected void Button1_Click1(object sender, EventArgs e)
    {
        RadGrid1.MasterTableView.InsertItem();
    }

    Regards,
    Daniel
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ian
    Ian avatar
    129 posts
    Member since:
    Jun 2009

    Posted 28 Jul 2010 Link to this post

    Hi Daniel,
    That partially worked although using your solution didn't seem to fire the RadGrid1_ItemCommand event so the code to hide the EditColumn wasn't executed. I got around this by including it in the LinkButton click handler:

    protected void Button1_Click1(object sender, EventArgs e)
    {
    RadGrid1.MasterTableView.InsertItem();
    GridEditCommandColumn editColumn = (GridEditCommandColumn)RadGrid1.MasterTableView.GetColumn("EditCommandColumn");
    editColumn.Visible = false;
    }

    Is that the best solution or is there a way to actually fire the ItemCommand event from an external control?
    Regards, Ian


  5. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 04 Aug 2010 Link to this post

    Hello Ian,

    It is also possible to fire the InitInsert command manually:
    RadGrid1.MasterTableView.Items[0].FireCommandEvent("InitInsert", "");

    Regards,
    Daniel
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  6. Ian
    Ian avatar
    129 posts
    Member since:
    Jun 2009

    Posted 05 Aug 2010 Link to this post

    Daniel,
    Hi. That works perfectly. Thanks.
    A suggestion: It might be worth adding a link in the 'Getting familiar with server-side API' section of the Grid documentation - this discusses all of the properties and events for the Grid but nothing about its methods. I never thought to look in the 'Control lifecycle' section of the  documentation where I now realise the FireCommandEvent is described!
    Thanks again, Ian
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017