简体   繁体   English

在Gridview中找不到控件编辑项目模板

[英]Can't Find Control Within Gridview Edit Item Template

I have the below code with which I'm trying to find the dropDownList ID of SupplierSelectDropDown in the sqldatasource update command, but nothing I'm trying is working. 我有以下代码,我正在尝试使用以下代码在sqldatasource update命令中找到SupplierSelectDropDowndropDownList ID,但是我没有尝试的方法。

I have tried to use ctl00$Content$DetailsPageControl$PurchaseTabGridView$DXEFL$edit0_4$SupplierSelectDropDown but that id changes depending on the number of rows. 我尝试使用ctl00$Content$DetailsPageControl$PurchaseTabGridView$DXEFL$edit0_4$SupplierSelectDropDown但该ID根据行数而变化。 Any help would be appreciated. 任何帮助,将不胜感激。

<dx:TabPage Name="Purchase" Text="Purchase">
  <ContentCollection>
    <dx:ContentControl runat="server">
      <dx:ASPxGridView ID="PurchaseTabGridView" runat="server" Theme="Youthful" KeyFieldName="detail_id" Width="100%" AutoGenerateColumns="False" DataSourceID="PurchaseTabDetail">
        <SettingsPager Visible="False"></SettingsPager>
        <SettingsDataSecurity AllowDelete="False" AllowInsert="False" />
        <Columns>
          <dx:GridViewCommandColumn ShowEditButton="True" ShowInCustomizationForm="True" VisibleIndex="0" Caption=" ">
          </dx:GridViewCommandColumn>
          <dx:GridViewDataTextColumn Caption="Code" FieldName="code" ShowInCustomizationForm="True" VisibleIndex="6">
            <EditFormSettings Visible="False" />
          </dx:GridViewDataTextColumn>
          <dx:GridViewDataTextColumn Caption="Description" FieldName="description" ShowInCustomizationForm="True" VisibleIndex="7">
            <EditFormSettings Visible="False" />
          </dx:GridViewDataTextColumn>
          <dx:GridViewDataTextColumn FieldName="supply_trader_id" ShowInCustomizationForm="True" Visible="False" VisibleIndex="10">
          </dx:GridViewDataTextColumn>
          <dx:GridViewDataTextColumn FieldName="supplyname" Caption="Supplier" ShowInCustomizationForm="True" Visible="true" VisibleIndex="8">
            <EditItemTemplate>
              <asp:DropDownList ID="SupplierSelectDropDown" DataSourceID="SupplierSelect" SelectedValue='<%# Eval("supply_trader_id") %>' DataValueField="trader_id" DataTextField="combined" runat="server"></asp:DropDownList>
            </EditItemTemplate>
          </dx:GridViewDataTextColumn>
        </Columns>
      </dx:ASPxGridView>

You can set ClientIDMode to static in your dropdown properties to avoid generated id's. 您可以在下拉属性中将ClientIDMode设置为static ,以避免生成ID。 Then perform a recursive search to find the control in order to save you the task of figuring out which is the parent container. 然后执行递归搜索以找到控件 ,以节省确定父容器的任务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM