How to Update by using dropdownlist value
<p>work on asp.net vs05.I have two table</p>

<pre><code>Table A        Table B
   ID          DistrictID
   Name        DistrictName
   FName
   MName
   District
</code></pre>

<p>By using the table a i fill a gridview</p>

<pre><code>     &lt;asp:GridView ID="GridView4" runat="server" AutoGenerateColumns="False" DataSourceID="SQL" DataKeyNames="StudentID" EmptyDataText="No information to display"&gt;
                &lt;Columns&gt;
                    &lt;asp:BoundField DataField="StudentID" HeaderText="StudentID" SortExpression="StudentID" /&gt;
                    &lt;asp:BoundField DataField="StudentName" HeaderText="StudentName" /&gt;
                    &lt;asp:BoundField DataField="FatherName" HeaderText="FatherName" SortExpression="FatherName" /&gt;
                    &lt;asp:BoundField DataField="DivisionName" HeaderText="DivisionName" /&gt;
                    &lt;asp:CommandField ShowEditButton="True" /&gt;
                &lt;/Columns&gt;
 &lt;/asp:GridView&gt;
        &lt;asp:SqlDataSource ID="SQL" runat="server" ConnectionString="&lt;%$ ConnectionStrings:JobTestConnectionString %&gt;"
            SelectCommand="SELECT StudentID, StudentName, FatherName FROM studentInfo" UpdateCommand="UPDATE studentInfo SET StudentID = @StudentID, StudentName = @StudentName, FatherName = @FatherName WHERE (StudentID = @StudentID)"&gt;
            &lt;UpdateParameters&gt;
                &lt;asp:Parameter Name="StudentID" /&gt;
                &lt;asp:Parameter Name="StudentName" /&gt;
                &lt;asp:Parameter Name="FatherName" /&gt;
            &lt;/UpdateParameters&gt;
        &lt;/asp:SqlDataSource&gt;
</code></pre>

<p>Now i  set a DropDownList on this grid .I set this on templetField.I want to fill this ddl by Table-B and also want  edit command  work correctly.</p>

<pre><code>&lt;asp:GridView ID="GridView4" runat="server" AutoGenerateColumns="False" DataSourceID="SQL" EmptyDataText="No information to display"&gt;
            &lt;Columns&gt;
                &lt;asp:BoundField DataField="StudentID" HeaderText="StudentID" SortExpression="StudentID" /&gt;
                &lt;asp:BoundField DataField="StudentName" HeaderText="StudentName" SortExpression="StudentName" /&gt;
                &lt;asp:BoundField DataField="FatherName" HeaderText="FatherName" SortExpression="FatherName" /&gt;
                &lt;asp:TemplateField HeaderText="DivisionName" SortExpression="DivisionName"&gt;
                    &lt;EditItemTemplate&gt;
                        &lt;asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="SqlD" DataTextField="StudentName"
                            DataValueField="StudentName" SelectedValue='&lt;%# Bind("DivisionName", "{0}") %&gt;'&gt;
                        &lt;/asp:DropDownList&gt;&lt;asp:SqlDataSource ID="SqlD" runat="server" ConnectionString="&lt;%$ ConnectionStrings:JobTestConnectionString %&gt;"
                            SelectCommand="SELECT [StudentName] FROM [Division]"&gt;&lt;/asp:SqlDataSource&gt;
                    &lt;/EditItemTemplate&gt;
                    &lt;ItemTemplate&gt;
                        &lt;asp:Label ID="Label1" runat="server" Text='&lt;%# Bind("DivisionName") %&gt;'&gt;&lt;/asp:Label&gt;
                    &lt;/ItemTemplate&gt;
                &lt;/asp:TemplateField&gt;
                &lt;asp:CommandField ShowEditButton="True" /&gt;
            &lt;/Columns&gt;
        &lt;/asp:GridView&gt;
</code></pre>

<p>Run this snipt browser show the bellow error:</p>

<p><strong>'DropDownList2' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value</strong> </p>

<p><strong>Now my question is how to set ddl by Table-B.After fill i want to update Table-A by using the command field of gridview.</strong></p>

<p>plz correct tag if necessary</p>
