When you say "HTML" view do you mean the Source view in Visual Studio?
I tried binding the two dropdownlists in the user control. ( see code below) but still get the... Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control, ERROR.
Is this how you were suggesting to bind the fields?
JimAmigo
Member
581 Points
267 Posts
Re: Error "Databinding methods such as Eval(), XPath(), and Bind() can only be used in the contex...
Dec 28, 2006 03:22 PM|LINK
When you say "HTML" view do you mean the Source view in Visual Studio?
I tried binding the two dropdownlists in the user control. ( see code below) but still get the... Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control, ERROR.
Is this how you were suggesting to bind the fields?
<%@ Control Language="C#" ClassName="JobTitles" AutoEventWireup="true" CodeFile="DisplayJobTitle.ascx.cs" Inherits="DisplayJobTitle" %> <asp:DropDownList ID="ddl_Contractors" runat="server" DataSourceID="ods_Contractors" DataTextField="ShortDescription" DataValueField="ContractorID" SelectedValue='<%# Bind("ContractorID") %>' AutoPostBack="True"> </asp:DropDownList> / <asp:DropDownList ID="ddl_JobTitles" runat="server" DataSourceID="ods_JobTitles" DataTextField="JobTitle" DataValueField="JobTitleID" SelectedValue='<%# Bind("JobTitleID") %>'> </asp:DropDownList><asp:ObjectDataSource ID="ods_JobTitles" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetJobTitlesByContractorID" TypeName="BMSDataSetTableAdapters.JobTitlesTableAdapter"> <SelectParameters> <asp:ControlParameter ControlID="ddl_Contractors" Name="contractorID" PropertyName="SelectedValue" Type="Decimal" /> </SelectParameters> </asp:ObjectDataSource> <asp:ObjectDataSource ID="ods_Contractors" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetContractors" TypeName="BMSDataSetTableAdapters.ContractorsTableAdapter"> </asp:ObjectDataSource>