title: Getting a Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control error
body: <p>I'm getting a "Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control." error message. I've looked here to see what others have said about that error. It looks to me as though some people have gotten the binding syntax wrong. I believe I am using the correct data binding, but I could be wrong. The error occurs on the first line of the DropDownList. I'm using VS 2015.</p>
  
  <pre><code>&lt;asp:DropDownList runat="server" ID="ddlUsersRating" AutoPostBack="True"
      DataSourceID="sdsUserRatings" DataTextField="RatingID"
      DataValueField="RatingID" Height="16px"
      SelectedValue='&lt;%# Bind("RatingID") %&gt;'
      AppendDataBoundItems="False"
      OnSelectedIndexChanged="ddlUsersRating_SelectedIndexChanged"&gt;
      &lt;asp:ListItem Value=""&gt;(Select a Rating)&lt;/asp:ListItem&gt;
      &lt;asp:ListItem Value="1"&gt;1&lt;/asp:ListItem&gt;
      &lt;asp:ListItem Value="2"&gt;2&lt;/asp:ListItem&gt;
      &lt;asp:ListItem Value="3"&gt;3&lt;/asp:ListItem&gt;
      &lt;asp:ListItem Value="4"&gt;4&lt;/asp:ListItem&gt;
      &lt;asp:ListItem Value="5"&gt;5&lt;/asp:ListItem&gt;
  &lt;/asp:DropDownList&gt;
  &lt;asp:SqlDataSource runat="server" ID="sdsUserRatings" 
      ConnectionString="&lt;%$ ConnectionStrings:VideoLibraryConnectionString %&gt;"
      InsertCommand="INSERT INTO UserRatings(UserID, ShowID, RatingID) VALUES (@UserID, @ShowID, @RatingID)"
      SelectCommand="SELECT UserRatings.RatingID FROM UserRatings INNER JOIN Users ON UserRatings.UserID = Users.UserID WHERE (UserRatings.ShowID = @ShowID) AND (Users.UserID = @UserID)"
      UpdateCommand="UPDATE UserRatings SET RatingID = @RatingID WHERE (UserID = @UserID) AND (ShowID = @ShowID)" OnInserted="sdsUserRatings_Inserted"&gt;
      &lt;InsertParameters&gt;
          &lt;asp:ControlParameter ControlID="ddlUsers" Name="UserID"
              PropertyName="SelectedValue" /&gt;
          &lt;asp:RouteParameter Name="ShowID" RouteKey="ShowID" /&gt;
          &lt;asp:ControlParameter ControlID="ddlUsersRating" Name="RatingID"
              PropertyName="SelectedValue" /&gt;
      &lt;/InsertParameters&gt;
      &lt;SelectParameters&gt;
          &lt;asp:RouteParameter Name="ShowID" RouteKey="ShowID" /&gt;
          &lt;asp:ControlParameter ControlID="ddlUsers" Name="UserID"
              PropertyName="SelectedValue" /&gt;
      &lt;/SelectParameters&gt;
      &lt;UpdateParameters&gt;
          &lt;asp:ControlParameter ControlID="ddlUsersRating" Name="RatingID"
              PropertyName="SelectedValue" /&gt;
          &lt;asp:ControlParameter ControlID="ddlUsers" Name="UserID"
              PropertyName="SelectedValue" /&gt;
          &lt;asp:RouteParameter Name="ShowID" RouteKey="ShowID" /&gt;
      &lt;/UpdateParameters&gt;
  &lt;/asp:SqlDataSource&gt;
  </code></pre>