[DevExpress Support Team: CLONED FROM T692348: ASPxGridView - How to get a value from the controls inside the Data Item template]
Could you please show me how to pre-populate the controls? For example, if I selected an item from an ASPxComboBox, then I want to pre-populate that value inside the ASPxTextBox control of the ASPxGridView.
ASPxGridView - How to pre-populate ASPxTextBox based on the value of ASPxComboBox in DataItemTemplate
Answers approved by DevExpress Support
Hello,
Thank you for your clarification.
I suggest you refer to the How to implement cascading ASPxComboBox controls for each ASPxGridView row example where a similar scenario is implemented. Instead of calling the second combobox' custom callback, you can set your custom ASPxTextBox control's value by using its SetText method in the combobox' SelectedIndexChanged event handler.
Hello,
Currently, your task is not completely clear. Do you need to implement this scenario for custom controls placed in the grid's DataItemTemplate or for the default grid editors? Please send us your current ASPxGridView configuration and describe your task in greater detail. This will help us provide you with a solution.
It is for custom controls placed in the grid's DataItemTemplate
How to pass a selected item value from ASPxComboBox to CustomTemplate class.
protected void gvItemAttribute_CellEditorInitialize(object sender, EventArgs e)
{
var test = cbSearch.Text;
//pass cbSearch.Text to CustomTemplate
ASPxGridView gvItemAttribute = (ASPxGridView)sender;
((GridViewDataColumn)gvItemAttribute.Columns["AttributeValue"]).DataItemTemplate = new CustomTemplate();
}