0

我正在开发 ASP.net Web 应用程序,而且我是 DevExpress 扩展的新手,所以我在自定义新控件时遇到了一些问题,我有一个 ASPxGridView ,它将在运行时使用 Web 服务绑定来获取数据并将它们绑定到列表或数据表中,然后将它们绑定到 gridView 中,在编辑表单模板中,我有一个相关的组合框,代表 CITY 和 AREA 以及 REGION,“AREA”组合框取决于“City”的值组合框,“城市”组合框绑定在初始化事件上,我想使用“城市”组合框中的选定值更改设置“区域”组合框的值.....我不知道的问题需要什么事件来做到这一点,

<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="width: 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="width: 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="width: 100%">
                        <dx:ASPxComboBox ID="regionSelect"    
                            runat="server">
                        </dx:ASPxComboBox>
                    </td>
                </tr>
                <tr>
                    <td style="white-space: nowrap">
                        Description
                    </td>
                    <td style="width: 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>
4

1 回答 1

0

使用 <%# Bind("你的字段")%>

<dx:ASPxComboBox ID="cityselect" runat="server" Value='<%# Bind("City") %>'
   DropDownStyle="DropDownList" IncrementalFilteringMode="StartsWith"
   TextField="Name" ValueField="ID"  
   oninit="cityselect_Init">
</dx:ASPxComboBox>
于 2014-12-25T03:43:30.040 回答