Adding a new item programmatically

2 posts, 0 answers
  1. Richard
    Richard avatar
    8 posts
    Member since:
    Jan 2019

    Posted 28 Feb 2020 Link to this post

    Hi there,

    I need the same fuctionality of the "Add" command of the grid's toolbar but using a button located anywhere in the page. Is this possible?

     

    <GridToolBar>
       <GridCommandButton Command="Add" Icon="add">Add Item</GridCommandButton>
    </GridToolBar>

    Thank you.

  2. Svetoslav Dimitrov
    Admin
    Svetoslav Dimitrov avatar
    191 posts

    Posted 02 Mar 2020 Link to this post

    Hello Richard,

    There are a few ways to approach that:

    • There is a thread in our Feedback Portal (link here) for a feature request that might suit your needs. If public methods for controlling the grid are implemented you will be able to invoke them from buttons anywhere on the page. I have given your Vote for it. You could also Follow it in order to receive email notifications for future status updates.
    • Another way of doing it is to use a custom form for editing or adding (for examples click here and here).
    • A third way could be by relocating the GridCommandButton "Add" by surrounding it in a div and use the position CSS property to put it anywhere on the page where you require. Here is a short sample:
      <GridToolBar>
              <div style="position:*position options*>
                  <GridCommandButton Command="Add" Icon="add">Add Item</GridCommandButton>
              </div>
      </GridToolBar>

    If neither of these work for you or require any further assistance, please do not hesitate to contact us. 

    Regards,
    Svetoslav Dimitrov
    Progress Telerik

     UI for Blazor

Back to Top