Ticket T694461
Visible to All Users

ASPxGridView - How to pre-populate ASPxTextBox based on the value of ASPxComboBox in DataItemTemplate

created 6 years ago

[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.

Comments (3)
Lanette (DevExpress Support) 6 years ago

    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();
                }

        Answers approved by DevExpress Support

        created 6 years ago (modified 6 years ago)

        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.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.