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.
Hello Darick Nguyen,
Which event are you using to configure those settings? Could you give a try to Page_Init event?
And also, please make sure the editor providers are re-created in every postback.
I hope this will help.
Oh Hello Noriko,
Thank you for your solution,
Sadly, I've tried it but it is not working either. I tried to create a Render Function that will run on page Init and will render Behaviors for RowAdding/RowDeleting/CellEditing, and then RefreshBehaviors/don't RefreshBehaviors(). Both give the same result.
Because the page will render again after Button Click event are fired (or Filter, Sorting, we must to rebind the dataset after that).
The point is we use this grid for many pages (1 grid config for ~ 20 pages) and the main problem is the Behaviors will be NULL in the Client, not the Provider is not working, because we must to call the RefreshBehaviors in code-behind after render to ensure all other behaviors will work (not only EditingCore). But it seems like only EditingCore behavior got this issue, other behaviors are still working.
Thank you and hopefully to hear your suggestion.