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.
Hello,Ether 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. I've shown both in the modifed aspx I have attached.
In my scenario, users can double click anywhere in row to open edit template. So i don't neccessarily endup clicking on the cell itself and so I dont have access to the EnteredEditMode, or exitEditMode itself.Also my issue isn't with the DropDownProvider itself. My issue is that when the edit template closes and itpasses it values to the cells. In cases where a cell is associated with a dropdownlist in the edit template,only the cell's value is set. But I would like the cell's text to be set to the corresponding dropDownlist's selected text.I could do it in cellValueChanged event, but I am only able to get a reference to the dropDownProvider whenuser click directly on the cell to open Edit template. If they click anywhere else it doesn't fire EnteringEditMode event.Can i get access to DropDownProvider in Cell change event? Do you have a mechanism to set the text as wellas the value of cell when Edit template closes?
Hello Rob,Please take a look at the sample i am attaching. When i update a cell it displays the text property of the dropdown item not the value property. Please take a look at the sample and modify your code based on it.
Hello,Please let me know if you have any further questions regarding this issue.