Is it possible to have add, edit and delete functionality in grouping grid? Here is sample grouping grid that I want to use for data editing - http://demos.telerik.com/aspnet-ajax/grid/examples/groupby/groupfooter/defaultcs.aspx
3 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 31 Jul 2009, 10:03 AM
Hi,
If you want to edit/delete each row in the grouped grid then you can follow either of the approaches explained in the following links:
In place edit mode
Automatic Operations
Manual Insert/Update/Delete operations using Auto-generated editform with sql statements from the code-behind
But if you want to edit/delete rows under a specific group on clicking buttons in the group header, then you can try out the following approach:
aspx:
c#:
Thanks
Princy.
If you want to edit/delete each row in the grouped grid then you can follow either of the approaches explained in the following links:
In place edit mode
Automatic Operations
Manual Insert/Update/Delete operations using Auto-generated editform with sql statements from the code-behind
But if you want to edit/delete rows under a specific group on clicking buttons in the group header, then you can try out the following approach:
aspx:
| <telerik:RadGrid DataSourceID="SqlDataSource1" AllowMultiRowEdit="true" |
| ID="RadGrid1" runat="server" OnItemDataBound="RadGrid1_ItemDataBound" |
| OnItemCreated="RadGrid1_ItemCreated"> |
| <MasterTableView DataSourceID="SqlDataSource1" EditMode="InPlace" > |
c#:
| protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) |
| { |
| AddButtonsinGroupHeader(e); |
| } |
| protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| AddButtonsinGroupHeader(e); |
| } |
| private void AddButtonsinGroupHeader(GridItemEventArgs e) |
| { |
| if (e.Item is GridGroupHeaderItem) |
| { |
| GridGroupHeaderItem item = e.Item as GridGroupHeaderItem; |
| DataRowView groupDataRow = (DataRowView)e.Item.DataItem; |
| Button btnEdit = new Button(); |
| btnEdit.Text = "EditGroup"; |
| btnEdit.ID = "Edit"; |
| btnEdit.Click += new EventHandler(btnEdit_Click); |
| Button btnDelete = new Button(); |
| btnDelete.Text = "DeleteGroup"; |
| btnDelete.ID = "Delete"; |
| btnDelete.Click += new EventHandler(btnDelete_Click); |
| item.DataCell.Controls.Add(btnEdit); |
| item.DataCell.Controls.Add(btnDelete); |
| } |
| } |
| void btnDelete_Click(object sender, EventArgs e) |
| { |
| Button btn = (Button)sender; |
| GridGroupHeaderItem headerItem = (GridGroupHeaderItem)btn.NamingContainer; |
| GridItem[] children = headerItem.GetChildItems(); |
| foreach (GridItem child in children) |
| { |
| // delete query |
| } |
| RadGrid1.Rebind(); |
| } |
| void btnEdit_Click(object sender, EventArgs e) |
| { |
| Button btn = (Button)sender; |
| GridGroupHeaderItem headerItem = (GridGroupHeaderItem)btn.NamingContainer; |
| GridItem[] children = headerItem.GetChildItems(); |
| foreach (GridItem child in children) |
| { |
| if (child is GridDataItem) |
| child.Edit = true; |
| } |
| RadGrid1.Rebind(); |
| } |
Thanks
Princy.
0
M
Top achievements
Rank 1
answered on 31 Jul 2009, 08:29 PM
I am not much into coding. I am designing mockup screens and wanted to know if my programmer can use single telerik grid to manuplate data as well use drag and drop columns for grouping and group footer.
Thanks,
Ali.
Thanks,
Ali.
0
Princy
Top achievements
Rank 2
answered on 03 Aug 2009, 08:10 AM
Hello Ali,
Yes, manipulation of data is possible within a grouped grid as in a normal grid, just that you would have to enable grouping and edit/insert/delete operations by setting the corresponding properties in the grid.
Thanks
Princy.
Yes, manipulation of data is possible within a grouped grid as in a normal grid, just that you would have to enable grouping and edit/insert/delete operations by setting the corresponding properties in the grid.
Thanks
Princy.