I need to pass the button again from the command column to the header, since the client does not like it to be repeated and wants it only once.
I've thought about it a thousand times and I can't find a way to keep it in the table without being part of the rows...
I leave the code below:
<dxwgv:ASPxGridView ID="gvNivelInformaticoUs" runat="server" Width="99%" ClientInstanceName="gvNivelInformaticoUs"
KeyFieldName="id" AutoGenerateColumns="False" Settings-HorizontalScrollBarMode="Hidden" OnRowInserting="gvNivelInformaticoUs_RowInserting"
OnRowUpdating="gvNivelInformaticoUs_RowUpdating" OnRowValidating="gvNivelInformaticoUs_RowValidating" OnRowDeleting="gvNivelInformaticoUs_RowDeleting" OnDataBinding="gvNivelInformaticoUs_DataBinding">
<Columns>
<dxwgv:GridViewDataTextColumn Caption="<%$ Resources: Recursos, Denominacion %>" FieldName="nombre_txt" VisibleIndex="0">
</dxwgv:GridViewDataTextColumn>
<dxwgv:GridViewDataTextColumn Caption="<%$ Resources: Recursos, nivel %>" FieldName="nivel_txt" VisibleIndex="0">
</dxwgv:GridViewDataTextColumn>
<dxwgv:GridViewDataTextColumn Caption=" " FieldName="nivel" VisibleIndex="0" Visible="false">
</dxwgv:GridViewDataTextColumn>
<dxwgv:GridViewCommandColumn Name="columnaEdicion" Width="90" ButtonType="Image" UpdateButton-Image-Url="../img/UPDATE_CA.png" CancelButton-Image-Url="../img/Cancel_CA.png">
<EditButton Visible="true" Image-Url="../img/edit.png"></EditButton>
<NewButton Visible="true" Image-Url="../img/add.png"></NewButton>
<DeleteButton Visible="true" Image-Url="../img/Cancel_CA.gif"></DeleteButton>
</dxwgv:GridViewCommandColumn>
</Columns>
<Templates>
<EditForm>
<div class="form-group col-sm-5">
<label><%= Resources.Recursos.Nombre%>*:</label>
<dxe:ASPxTextBox ID="TxtNombreInformatica" MaxLength="250" CssClass="form-control col-sm-8" runat="server" ValueField="id" TextField="Nombre" OnInit="TxtNombreInformatica_Init"></dxe:ASPxTextBox>
</div>
<div class="form-group col-sm-5">
<label><%= Resources.Recursos.nivel%>*:</label>
<dxe:ASPxComboBox ID="CmbNivelInformatica" CssClass="form-control col-sm-8" runat="server" ValueField="id" TextField="Nombre" OnInit="CmbNivelInformatica_Init"></dxe:ASPxComboBox>
</div>
<div class="form-group col-sm-2">
<span class="separador"> </span>
<dxwgv:ASPxGridViewTemplateReplacement ID="ASPxGridViewTemplateReplacement1" runat="server" ReplacementType="EditFormUpdateButton" />
<dxwgv:ASPxGridViewTemplateReplacement ID="ASPxGridViewTemplateReplacement2" runat="server" ReplacementType="EditFormCancelButton" />
</div>
</EditForm>
</Templates>
</dxwgv:ASPxGridView>
You could leave the button outside the grid anywhere and in the button's click event on the client side you use:
Here are some reference links to the DevExpress Grid
https://documentation.devexpress.com/AspNet/DevExpress.Web.Scripts.ASPxClientGridView.AddNewRow.method
Here is another example with the same technique but with the button inside a column header:
https://www.devexpress.com/Support/Center/Question/Details/Q339207/aspxgridview-how-to-add-the-new-button-to-a-command-column-header