Hi,
I am using DropDownProvider which is dynamically added to webdatagrid,the grid loads correctly but on post back it give error as shown in the error.jpg.Below is the code snippet used to load DropDownProvider dynamically.
this.wdgPartnerAttributes.Behaviors.CreateBehavior<EditingCore>(); this.wdgPartnerAttributes.Behaviors.EditingCore.Behaviors.CreateBehavior<CellEditing>();
DropDownProvider ddlProvider = new DropDownProvider(); ddlProvider.EditorControl.DataSource = collection;
ddlProvider.ID = " ddlProvider 1" + cnt; this.wdgPartnerAttributes.EditorProviders.Add(ddlProvider); EditingColumnSetting columnSetting = new EditingColumnSetting(); columnSetting.ColumnKey = "Key1"; columnSetting.EditorID = ddlProvider.ID; this.wdgPartnerAttributes.Behaviors.EditingCore.Behaviors.CellEditing.ColumnSettings.Add(columnSetting);
Hi, It's hard to say what's going on from the snippet provided. Are you creating the dropdownprovider on each postabck or only the first time ? Would you consider defining it in the markup rather then in code - behind?
Hi Rado,
As per our requirement the grid has dynamic columns,the edit-provider for the column in grid is decided at run-time so i can only add the Drop-down Provider in code behind as the column key is dynamic.The page loads correctly for the first time but when the submit button is click even before the page load event this error arises.
By using the approach of session we will only be able to add the providers to the grid on post back and the in place edit of drop down will not be available first time when the page loads.As the value in the session is stored in bind grid grid method which is called after init event. or it might be the case that you are using version 12 and i am using version 11.
Hi Nitin, it's my mistake, the attached sample shoud work now.
Thanks for providing the solution for my issue.Can you please provide me the solution for issue of "EditProvider for Checkbox" which is already posted on this forum.
The only issue i figured out in this solution is that we will not be able to retrieve value of any control in init event i.e the record on the grid is based on the filter of the value selected in two drop downs and we also have to implement paging which in our case is implemented using a common control.So the only way to access the controls is through storing the value of controls in session.So it would be very helpful if you are able to suggest a work around on this.
One thing is sure, it's too late to create the EditorProvider in Load or after load phase, you need to do it in Init, probably you can create them and add to the EditorProviders collection in Init phase, however initialize them on page load when you have the values defining the condition.