我想使用详细信息视图更新我的记录。 一切都比edititem模板中的下拉列表好。
当我从下拉列表(与差异表绑定)中选择值时,我收到错误System.ArgumentOutOfRangeException:'DropDownList1'。
请帮助。 谢谢你。
“ ProviderName =” <%$ ConnectionStrings:MyConString.ProviderName%>“ SelectCommand =”从元数据中选择类型,TYPEID“>
</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>