We have built our own custom control that has a WebHierarchicalDataGrid. We are building columns and our edit template dynamically.
Inside of our Edit Template we have a Dropdownlist. When the edit template closes it updates the appropriate cell, but the cell displays the valueField from the dropdown but we need it to display textfield.
We dynamically add RowEditingClientBinding to our behaviors:
getValueJavaScript = "$get('" + clientId + "').value";
setValueJavaScript = "$get('" + clientId + "').value={value}";
var item = new RowEditingClientBinding
{
ColumnKey = dataFieldName,
ControlID = clientId,
GetValueJavaScript = getValueJavaScript,
SetValueJavaScript = setValueJavaScript
};
Grid.GridView.Behaviors.EditingCore.Behaviors.RowEditTemplate.ClientBindings.Add(item);
Our columns is a bound column in the grid and uses an editorprovider with a DropDownProvider inside of it.
var ddlProvider = ((DropDownProvider)Grid.EditorProviders["ddProvider"]).EditorControl;
ddlProvider.DataSource = dt;
ddlProvider.DataBind();
Grid.GridView.Behaviors.CreateBehavior<EditingCore>();
Grid.GridView.Behaviors.EditingCore.Behaviors.CreateBehavior<CellEditing>();
Grid.GridView.Behaviors.EditingCore.Behaviors.CellEditing.ColumnSettings.Add(new EditingColumnSetting { ColumnKey = dataFieldName, ReadOnly = readOnly, EditorID = ddlProvider.ID });
Hello,I assume issue comes when the editor is being loaded. The editor is being loaded with the new items for the drop down in the entered edit mode event. By this point, the editor has already had its value set from the cell. So it tried to set the value to new value to the corresponding cell, but that value is not in the drop down item list yet. So either the editor needs to be loaded before entering edit mode or the value needs to be set afterwards (in response complete), or after edited mode. Can you provide information like what is your exact build and if it is possible to attach an aspx+c# page sample of what exactly you are trying to achieve and your implementation? Also am I right to understand that you are using asp DropDownList instead of our WebDropDown?
unfortunutely it is going to be difficult to provide you with a sample as we have create a custom control with whdg inside of it. We are building the grid dynamically in some custom classes. Anyways it works fine when entering edit mode, the dropdownlist in grid and in the edit provider load correctly. You are correct that we are using a an asp.net dropdownlist in our edit provider. I would like to know how to set the value of the dropdownprovider after the editor closes. if you have a quick snippet that would be great. Otherwise I will work on trying create a sample to mimics what we are trying to do.