Attached a site it has two band hierarchical grid, second band has 'add' behavior added. Can you show how to remove this behavior for the first parent row only ( the one with 'Net Trade01' in first column. so all child grid will have add row functionality except the one under the first row.
Thanks.
Hello mcseidel,
I am just following up to see if you need any further assistance with this matter.
Thank you for the update. You can remove row adding behavior from the first row island (underneath ‘Net Trade01’ parent record) as shown below:
if (!IsPostBack) {
CreateDataSource();
foreach (ContainerGridRecord rec in this.whdg.GridView.Rows) {
//Check if the row index is 0
if (rec.Index == 0 ) {
rec.RowIslands[0].Behaviors.EditingCore.Behaviors.Remove(rec.RowIslands[0].Behaviors.EditingCore.Behaviors.RowAdding); } } }
I hope this helps.
Sorry that is not what I'm looking for, it is slightly different : Let me go over again. There is two band grid, second ( child band ) has a ‘add row’ behavior configured during design time… and when you open every child grid you would see ability to add row in each of it. Here is the question : How to dynamically or otherwise remove ‘add row’ behavior for the topmost child grid, the one that underneath ‘Net Trade01’ parent record. So at the end of exercise every child grid has ‘add row’ behavior except the topmost one. Picture with desired result is attached
Based on my understanding, you want to implement column moving behavior except first row island. If this is the case I would recommend you to add the behavior in code behind( not in markup) on rowisland bases as shown below:
if (!IsPostBack)
{
var wh=this.whdg.Behaviors.CreateBehavior<Infragistics.Web.UI.GridControls.ColumnMoving>();
if (rec.Index == 0) { rec.RowIslands[0].Behaviors.Remove(wh); }
else { rec.RowIslands[0].Behaviors.Add(wh); } } }
I have also attached modified sample.