Asp.Net Detailsview EditItemTemplate Обновление - PullRequest
0 голосов
/ 07 декабря 2018

Я хочу обновить свои записи, используя подробные представления.Все работает лучше, чем выпадающий список в шаблоне edititem.

Когда я выбираю значение из выпадающего списка (связанного с другой таблицей), я получаю сообщение об ошибке System.ArgumentOutOfRangeException: 'DropDownList1'.

Пожалуйста, помогите,Большое спасибо.

"ProviderName =" <% $ ConnectionStrings: MyConString.ProviderName%> "SelectCommand =" SELECT TYPE, TYPEID FROM meta ">

       </asp:SqlDataSource>




       <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MyConString %>" ProviderName="<%$ ConnectionStrings:MyConString.ProviderName %>"  UpdateCommand="UPDATE documents SET FILENAME = @FILENAME, TITLE = @TITLE, REVISION =@REVISION, REVISION_DATE =@REVISION_DATE, ISSUE_COD =@ISSUE_COD, ISSUE_DATE =@ISSUE_DATE, TRANSMITTAL =@TRANSMITTAL, WBS =@WBS, DOCUMENT_TYPE =@DOCUMENT_TYPE  WHERE (ID = @ID)" SelectCommand="SELECT ID,FILENAME,TITLE,REVISION,REVISION_DATE,ISSUE_COD,ISSUE_DATE,TRANSMITTAL,WBS,DOCUMENT_TYPE FROM documents WHERE id= ?"   >
           <SelectParameters>
      <asp:SessionParameter
        Name="id"
        SessionField="KEY"
        DefaultValue="9" />
  </SelectParameters>



       </asp:SqlDataSource>

       <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>





     <ajaxToolkit:TabContainer ID="TabContainer1" runat="server" TabIndex="3" ActiveTabIndex="0" TabStripPlacement="TopRight" UseHorizontalStripPlacement="True">
         <ajaxToolkit:TabPanel runat="server" HeaderText="METADATA" ID="TabPanel1">
             <ContentTemplate>



                 <asp:DetailsView ID="DetailsView2" runat="server"  Width="100%" DataSourceID="SqlDataSource1" AutoGenerateEditButton="True" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical" AutoGenerateRows="False" >
           <AlternatingRowStyle BackColor="Gainsboro" />
           <EditRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
                     <Fields>

                         <asp:boundfield datafield="ID"  headertext="ID"/>
                         <asp:boundfield datafield="FILENAME"  headertext="FILENAME"/>
                         <asp:boundfield datafield="TITLE"  headertext="TITLE"/>
                         <asp:boundfield datafield="REVISION"  headertext="REVISION"/>
                         <asp:boundfield datafield="REVISION_DATE"  headertext="REVISION_DATE"/>
                         <asp:boundfield datafield="ISSUE_COD"  headertext="ISSUE_COD"/>
                         <asp:boundfield datafield="ISSUE_DATE"  headertext="ISSUE_DATE"/>
                         <asp:boundfield datafield="TRANSMITTAL"  headertext="TRANSMITTAL"/>
                         <asp:boundfield datafield="WBS"  headertext="WBS"/>                           
                         <asp:TemplateField HeaderText="DOCUMENT_TYPE" >

                             <EditItemTemplate>

                                 <asp:DropDownList ID="DropDownList1" DataSourceID="SqlDataSource2" runat="server" SelectedValue='<%# Bind("TYPEID") %>' DataTextField="TYPE" DataValueField="TYPE"></asp:DropDownList>
                             </EditItemTemplate>

                            <ItemTemplate><%#Eval("DOCUMENT_TYPE")%></ItemTemplate>

                         </asp:TemplateField>








                     </Fields>
           <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
           <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
                     <HeaderTemplate>
                         METADATA
                     </HeaderTemplate>
           <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
           <RowStyle BackColor="#EEEEEE" ForeColor="Black" />                   

       </asp:DetailsView> 

             </ContentTemplate>

         </ajaxToolkit:TabPanel>
         <ajaxToolkit:TabPanel ID="TabPanel2" runat="server" HeaderText="HISTORY">
         </ajaxToolkit:TabPanel>
         <ajaxToolkit:TabPanel ID="TabPanel3" runat="server" HeaderText="LINK">
         </ajaxToolkit:TabPanel>
           <ajaxToolkit:TabPanel ID="TabPanel4" runat="server" HeaderText="TOOLS">
         </ajaxToolkit:TabPanel>
       </ajaxToolkit:TabContainer>
...