我正在开发ASP.net Web应用程序,我是DevExpress扩展的新手,所以我在定制新控件方面遇到了一些问题, 我有一个ASPxGridView,它将在运行时使用Web服务绑定以获取数据并将它们绑定到列表或数据表然后将它们绑定到gridView,在编辑表单模板中我有一个相关的组合框代表CITY和在AREA和REGION中,“AREA”组合框取决于“City”组合框的值,“City”组合框对init事件具有约束力,我想改变使用所选择的“区域”组合框的值设置价值在“ CIty“combobox .....我不知道需要做什么事情的问题,
<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>
答案 0 :(得分:0)
使用&lt;%#Bind(&#34;您的字段&#34;)%&gt;
<dx:ASPxComboBox ID="cityselect" runat="server" Value='<%# Bind("City") %>'
DropDownStyle="DropDownList" IncrementalFilteringMode="StartsWith"
TextField="Name" ValueField="ID"
oninit="cityselect_Init">
</dx:ASPxComboBox>