ASPxComboBox inside editForm template in ASPxGridView

ASPxComboBox inside editForm template in ASPxGridView

I am working on ASP.net web application, and I am new to DevExpress extensions, so i am having some problems on customize the new controls, I have a ASPxGridView , which will bind in the run time using a web service to get the data and bind them into a list or datatable then binding them into the gridView , in the Edit Form Template I have a related comboboxes which represent the CITY and the AREA and the REGION, the "AREA" combobox depends on the value of the "City" combobox, the "City " combobox is binding on the init event, I want to change set the values of the "Area" combobox using the selected value in the " CIty " combobox ..... the problem that I don't know what is the needed events to do that,

<dx:ASPxGridView ID="grid" ClientInstanceName="grid" runat="server" 
    KeyFieldName="ID" AutoGenerateColumns="False" Width="100%" 
            onrowupdating="grid_RowUpdating" 
             >
    <Columns>
        <dx:GridViewCommandColumn VisibleIndex="0" ShowSelectCheckbox="True">
            <EditButton Visible="True" />
            <NewButton Visible="True" />
            <DeleteButton Visible="True">
            </DeleteButton>
            <ClearFilterButton Visible="True">
            </ClearFilterButton>
        </dx:GridViewCommandColumn>
        <dx:GridViewDataTextColumn FieldName="ID" VisibleIndex="1" />
        <dx:GridViewDataTextColumn FieldName="City" VisibleIndex="2" />
        <dx:GridViewDataColumn FieldName="Area" VisibleIndex="3" />
        <dx:GridViewDataColumn FieldName="Region" VisibleIndex="4"  />
        <dx:GridViewDataColumn FieldName="Description" Visible="False" />
    </Columns>
            <SettingsBehavior AllowSelectByRowClick="True" />
    <SettingsPager AlwaysShowPager="True" PageSize="4" />
            <Settings ShowFilterRow="True" />
    <Templates>
        <EditForm>
            <table class="OptionsTable" >
                <tr>
                    <td style="white-space: nowrap">
                        City
                    </td>
                    <td style=" 50%">
                        <dx:ASPxComboBox ID="cityselect" runat="server" DropDownStyle="DropDownList" IncrementalFilteringMode="StartsWith"
                            TextField="Name" ValueField="ID"
                            EnableSynchronization="False" oninit="cityselect_Init">
                        </dx:ASPxComboBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        Area
                    </td>
                    <td style=" 100%"><dx:ASPxComboBox runat="server" ID="CmbArea" ClientInstanceName="cmbArea" 
                            DropDownStyle="DropDown" TextField="Name"
                            ValueField="ID" IncrementalFilteringMode="StartsWith" 
                            EnableSynchronization="False" >
                        </dx:ASPxComboBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        Region
                    </td>
                    <td style=" 100%">
                        <dx:ASPxComboBox ID="regionSelect"    
                            runat="server">
                        </dx:ASPxComboBox>
                    </td>
                </tr>
                <tr>
                    <td style="white-space: nowrap">
                        Description
                    </td>
                    <td style=" 50%">
                       <dx:ASPxTextBox   runat="server" ID="Description" Value='<%# Eval("Description") %>' Width="100%">
                       </dx:ASPxTextBox> 
                    </td>
                </tr>
            </table>
            <div style="text-align: right; padding: 2px">
                <dx:ASPxGridViewTemplateReplacement ID="UpdateButton" ReplacementType="EditFormUpdateButton"
                    runat="server">
                </dx:ASPxGridViewTemplateReplacement>
                <dx:ASPxGridViewTemplateReplacement ID="CancelButton" ReplacementType="EditFormCancelButton"
                    runat="server">
                </dx:ASPxGridViewTemplateReplacement>
            </div>
        </EditForm>
    </Templates>
</dx:ASPxGridView>

using <%# Bind("your field")%>

<dx:ASPxComboBox ID="cityselect" runat="server" Value='<%# Bind("City") %>'
   DropDownStyle="DropDownList" IncrementalFilteringMode="StartsWith"
   TextField="Name" ValueField="ID"  
   oninit="cityselect_Init">
</dx:ASPxComboBox>
原文地址:https://www.cnblogs.com/grj001/p/12223468.html