title: How to bind dropdownlist to a grid view in asp.net??? Here dropdownlist is not inside gridview
body: <p>I am trying to bind gridview to a dropdownlist meaning when i change my dropdownlist value data must be accordingly displayed in asp.net.But whenever i build the application following errror occurs:</p>
  
  <p><strong>DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'ClassName'.</strong></p>
  
  <p>How can i solve this error?? I have configured two different tables of same database as a source for  gridview and dropdownlist.When i test query in gridview in case of data configuration, data comes in form of rows and columns but when i build application above error occurs. My aspx code is below:</p>
  
  <pre><code> &lt;asp:GridView ID="Resultgridview" runat="server" AutoGenerateColumns="False" 
                  DataKeyNames="StudentID" DataSourceID="SqlDataSource1"&gt;
                  &lt;Columns&gt;
                      &lt;asp:BoundField DataField="StudentID" HeaderText="StudentID" 
                          InsertVisible="False" ReadOnly="True" SortExpression="StudentID" /&gt;
                      &lt;asp:BoundField DataField="Class" HeaderText="Class" SortExpression="Class" /&gt;
                      &lt;asp:BoundField DataField="Section" HeaderText="Section" 
                          SortExpression="Section" /&gt;
                      &lt;asp:BoundField DataField="StudentName" HeaderText="StudentName" 
                          SortExpression="StudentName" /&gt;
                      &lt;asp:BoundField DataField="RollNo" HeaderText="RollNo" 
                          SortExpression="RollNo" /&gt;
                      &lt;asp:BoundField DataField="Address" HeaderText="Address" 
                          SortExpression="Address" /&gt;
                      &lt;asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" /&gt;
                      &lt;asp:BoundField DataField="GuardianName" HeaderText="GuardianName" 
                          SortExpression="GuardianName" /&gt;
                      &lt;asp:BoundField DataField="GuardianPhone" HeaderText="GuardianPhone" 
                          SortExpression="GuardianPhone" /&gt;
                  &lt;/Columns&gt;
              &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>My cs code looks like this</p>
  
  <pre><code>  protected void ClassDropdownlist_SelectedIndexChanged(object sender, EventArgs e)
  {
      Resultgridview.DataSource = SqlDataSource1;
      Resultgridview.DataBind();
  
      //SqlConnection con = new SqlConnection("Data Source=(local);Initial Catalog=dbbilling;User ID=sa;Password=sa123");
      //SqlDataAdapter da = new SqlDataAdapter("select StudentName from students where Class='" + ClassDropdownlist.SelectedItem.Text + "'", con);
      //DataTable dt = new DataTable();
  }
  </code></pre>
  
  <p>What must i add and uncomment in cs file??</p>