2013-07-02 53 views
0

我正在研究ASP.net web應用程序,並且我是DevExpress擴展的新手,所以我在定製新控件時遇到了一些問題,我有一個ASPxGridView,它將綁定在運行時使用Web服務獲取數據並將它們綁定到列表或數據表中,然後將它們綁定到GridView中,在編輯表單模板中我有一個相關的組合框表示CITY和AREA以及REGION,「AREA」組合框取決於「城市」組合框的值,「城市」組合框綁定在init事件上,我想更改使用「 城市」組合框中的選定值設置「區域」組合框的值。 ...我不知道需要做什麼事情的問題,ASPxComboBox ASPXGridView裏面的editForm模板

使用<%#綁定( 「你的領域」)%
<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

>

<dx:ASPxComboBox ID="cityselect" runat="server" Value='<%# Bind("City") %>' 
    DropDownStyle="DropDownList" IncrementalFilteringMode="StartsWith" 
    TextField="Name" ValueField="ID" 
    oninit="cityselect_Init"> 
</dx:ASPxComboBox>