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)
if (target.Behaviors.EditingCore.Behaviors.RowDeleting == null)
if (target.Behaviors.EditingCore.Behaviors.CellEditing == null)
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.ToString();
provider.EditorControl.TextField = MyDataSet.Columns.Columns.ToString();
Then, I should call the RefreshBehaviors() to ensure these changes are applied.
However, the call may cause some problem in Client side:
- 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.
I'm investigating your inquiry and it is going to take longer time. I'll make an update if there is any progress, so could you wait for a while?
Thank you for your understanding.
Thank you for your reply.
I'm very appreciate that.
Here's some other information about our page, I hope it can you you guy can investigate the problem easier:
- WebHierarchicalDataGrid is put in a Custom Control (Ascx)
- We do put that Ascx in a WebForm Template, it will be be add into the TemplatePlaceholder once rendered. (Sadly, I can't change this old structure, because of the container contains many Script and Generic Event)
- Currently, I've tried to let the RefreshBehavior execute one time only for the whole life cycle, however, the editingCore on client side is still null on every post back.
Thanks & regards.
Sorry for having kept you waiting for a while.
I created a small sample which demonstrates how to create and add a DropDownProvider in code-behind. I hope this sample will help you.