Dynamically Binding Error

May 22, 2008 at 2:44 PM
Error Message: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control

I have the following TemplateField:
<asp:TemplateField HeaderText="Style">
        <asp:DropDownList ID="ddlAssetStyle" runat="server" DataSourceID="SqlDataSourceAssetStyle"
            DataTextField="StyleNme" DataValueField="id_AssetStyle" SelectedValue='<%# Bind("AssetStyleID") %>'
                        AppendDataBoundItems="true" EnableViewState="true">
                <asp:SqlDataSource ID="SqlDataSourceAssetStyle" runat="server" SelectCommand="p_Data"
            SelectCommandType="StoredProcedure" ConnectionString="<%$ ConnectionStrings:Dev01ConnectionString %>">

This is the only column that is data bound and must be causing the error. This field works fine with a normal GridView.
I bind the gridview programmatically using a LINQ query.

Thanks in advance.