Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
30
WebHierarchicalDataGrid not render EditingCore (client-side) after multiple RefreshBehaviors
posted

Hi all,

Currently I'm handling the WebHierarchicalDataGrid from Infragistics v 18.23. Mostly the Columns, Behavior are inserted in the code-behind. My system are not allowed to use Ajax so I have encountered a lot of problem with the grid.

I do bind the DropDownList everytime after the postback to ensure that the DropDownList not getting broken after every postback. After that, I also modify some Behavior in the Grid.

                target.Behaviors.EditingCore.AutoCRUD = false;
                target.Behaviors.EditingCore.BatchUpdating = true;
                target.Behaviors.EditingCore.EnableInheritance = true;
                if (target.Behaviors.EditingCore.Behaviors.RowAdding == null)
                    target.Behaviors.EditingCore.Behaviors.CreateBehavior<RowAdding>();
                if (target.Behaviors.EditingCore.Behaviors.RowDeleting == null)
                    target.Behaviors.EditingCore.Behaviors.CreateBehavior<RowDeleting>();
                if (target.Behaviors.EditingCore.Behaviors.CellEditing == null)
                    target.Behaviors.EditingCore.Behaviors.CreateBehavior<CellEditing>();
                

After that, I should rebind the DropDownList dataSource to ensure the DropDown Provider not showing the value after the postback.

                    var provider = whdg.GridView.EditorProviders[key] as DropDownProvider;

                    var dataView = new DataView(MyDataSet);
                    provider.EditorControl.DataSource = dataView;
                    provider.EditorControl.ValueField = MyDataSet.Columns[0].ToString();
                    provider.EditorControl.TextField = MyDataSet.Columns.Columns[1].ToString();
                    provider.EditorControl.DataBind();

Then, I should call the RefreshBehaviors() to ensure these changes are applied.

However, the call may cause some problem in Client side:

- If I execute RefreshBehaviors() (after posted back), the editingCore() i retrieve in Client side (javascript) will return null, therefore I can't insert, add, delete rows.

- If I don't execute RefreshBehavior() (after posted back), the editingCore() will be fine, however, the DropDownList inside the Grid will display value instead of text, and I can't select anything from the DropdownList.

This problem only occur if there's a Band or more Bands in the Grid (If the grid has no band, it will work perfectly).

I'm out of idea now. Do you have any solution for this? Cuz I found that I don't have any function like Behavior.CreateBehavior<EditingCore>() (C# code behind) in the client side.