4
votes

Can I add the NewButton in the header template of the aspxgridview(DevExpress Control) to insert a new record to the aspxgridview ?becuase I don't want to add the NewButton in every row in the grid

I would appreciate any help in this

3

3 Answers

6
votes

Try this link

This has been brought up a few times (and answered) on the DevExpress forums.

The crux of the solution is to add a footer template to your grid and then put an html button in the footer with the OnClick handler set to mygridname.AddNewRow();

as in...

<input id="btnAdd" type="button" value="Add" onclick="grid.AddNewRow();" />
2
votes

To answer your question, I've never seen this done in the header of a GridView (probably because most users wish to keep the column headings that are done in the header). I'm a bit curious about this myself.

I have seen this done in the footer, though. If you'd like to do it that way, here are a few links (with pictures, horray) to get you started:

HTH.

0
votes

http://www.devexpress.com/Support/Center/Question/Details/Q357944

I hope this forum will help you

Just Try the below code

<dx:ASPxGridView ID="grvParametros" ClientInstanceName="grid" runat="server" ...>
    ...
    <Templates>
        <Header>
            <a href="javascript:grid.AddNewRow()">New</a>
        </Header>
    </Templates>
</dx:ASPxGridView>