Edit command erroring out in gridiview

gebruiker6

New Member
Iam unable to identify the problem which is causing the edit command to failGridView Code\[code\]<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="Requestid" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" Height="321px" Width="604px"> <AlternatingRowStyle BackColor="White" /> <Columns> <asp:CommandField ShowEditButton="True" UpdateText="Submit" /> <asp:BoundField DataField="Requestid" HeaderText="Requestid" ReadOnly="True" SortExpression="Requestid" /> <asp:BoundField DataField="Receiveddate" HeaderText="Receiveddate" SortExpression="Receiveddate" /> <asp:BoundField DataField="Ctname" HeaderText="Ctname" SortExpression="Ctname" /> <asp:TemplateField HeaderText="Requestor" SortExpression="Requestor"> <EditItemTemplate> <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource2" DataTextField="analystname" DataValueField="contact_id" SelectedValue='http://stackoverflow.com/questions/13726856/<%# Bind("Requestor") %>'> </asp:DropDownList> <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:Customers %>" SelectCommand="SELECT [contact_id], [first_name]+ space(1)+ [last_name] as analystname FROM [contact]order by contact_id"></asp:SqlDataSource> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Bind("Requestor") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> </Columns> <EditRowStyle BackColor="#CC3300" /> <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#CBB06D" Font-Bold="True" ForeColor="White" /> <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" /> <RowStyle BackColor="#EFF3FB" /> <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" /> <SortedAscendingCellStyle BackColor="#F5F7FB" /> <SortedAscendingHeaderStyle BackColor="#6D95E1" /> <SortedDescendingCellStyle BackColor="#E9EBEF" /> <SortedDescendingHeaderStyle BackColor="#4870BE" /></asp:GridView><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Customers %>" SelectCommand="SELECT RR.Requestid,Convert(varchar(20),RR.Receiveddate,100) as Receiveddate,RR.Ctname,C.First_Name +Space(1) + C.Last_NAME as Requestor from report_request_draft RR inner join Contact C on RR.requestor = C.contact_idwhere clonedfromid is not null"UpdateCommand="UPDATE [REPORT_REQUEST_DRAFT] SET [REQUESTOR] = @Requestor WHERE [requestid] = @requestid"></asp:SqlDataSource>\[/code\]When i click on the edit command button it gives me the below errorError'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items.Parameter name: value Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentOutOfRangeException: 'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items.Parameter name: value
 
Back
Top