I have a DetailsView which is inside of a FormView. I lifted this
DetailsView straight off another one of my pages, where it was working
beautifully. Now I get this endlessly frustrating error message
whenever I try to go into Edit mode:
Specified argument was out of the range of valid values.
Parameter name: index
The DetailsView is actually inside an UpdatePanel, which is inside an
Ajax Accordion, which is inside the FormView. Could possibly be this,
but my Insert and my ReadOnly templates work perfectly.
I started stripping it down (it was pretty complex) but I have the
same results. Here's the code for my DetailsView and my SqlDataSource.
I took everything out of my DetailsView except for the Edit button and
1 field. Like I said, both other templates work fine:
<asp:SqlDataSource ID="dsSpecificInj" runat="server"
ConnectionString="<%$ ConnectionStrings:Conn_String %>"
SelectCommand="a valid select statement">
<SelectParameters>
<asp:QueryStringParameter Name="CINJ_ID"
QueryStringField="CINJ_ID" Type="string" />
</SelectParameters>
<InsertParameters>
<asp:QueryStringParameter QueryStringField="CINJ_id"
Name="CINJ_ID" Type="String" />
<asp:SessionParameter SessionField="Username"
Name="CREATED" Type="String" />
</InsertParameters>
<UpdateParameters>
<asp:SessionParameter SessionField="Username"
Name="UPDATED" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>
<asp:DetailsView ID="dvInjury" runat="server" Width="100%"
DataKeyNames="CINJ_ID"
DataSourceID="dsSpecificInj" DefaultMode="ReadOnly" EmptyDataText="No
current record."
AutoGenerateRows="false">
<FieldHeaderStyle VerticalAlign="Top" Width="20%" Font-Bold="true" />
<FooterStyle BackColor="AliceBlue" HorizontalAlign="Center" />
<FooterTemplate>
<asp:Button ID="btnEdit" runat="server" Text="Edit This Injury"
CommandName="Edit"></asp:Button>
</FooterTemplate>
<RowStyle HorizontalAlign="Left" />
<Fields>
<asp:BoundField DataField="CINJ_DT" />
</Fields>
</asp:DetailsView>
Any help would be appreciated.