To add a custom button, add this to your command column in the aspx side:
<dxwgv:ASPxGridView ID="grid" ClientInstanceName="grid" runat="server" DataSourceID="AccessDataSource1" KeyFieldName="EmployeeID" AutoGenerateColumns="False" Width="100%" OnCustomButtonCallback="grid_CustomButtonCallback" OnInitNewRow="grid_InitNewRow">
<Columns>
<dxwgv:GridViewCommandColumn VisibleIndex="0">
<EditButton Visible="True" />
<NewButton Visible="True" />
<CustomButtons>
<dxwgv:GridViewCommandColumnCustomButton Text="Create a Copy" ID="Copy" />
</CustomButtons>
</dxwgv:GridViewCommandColumn>
Then in your codebehind:
public partial class GridEditing_EditForm : BasePage {
protected void Page_Load(object sender, EventArgs e) {
}
Hashtable copiedValues = null;
string[] copiedFields = new string[] { "FirstName", "Title", "Notes", "LastName", "BirthDate", "HireDate" };
protected void grid_CustomButtonCallback(object sender, ASPxGridViewCustomButtonCallbackEventArgs e) {
if(e.ButtonID != "Copy") return;
copiedValues = new Hashtable();
foreach(string fieldName in copiedFields) {
copiedValues[fieldName] = grid.GetRowValues(e.VisibleIndex, fieldName);
}
grid.AddNewRow();
}
protected void grid_InitNewRow(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e) {
if(copiedValues == null) return;
foreach(string fieldName in copiedFields) {
e.NewValues[fieldName] = copiedValues[fieldName];
}
}
}
You can see the full demo here:
http://demos.devexpress.com/ASPxGridViewDemos/Columns/CommandColumnCustomButtons.aspx