Hi,
I have a detailsview that contains templated fields. In the Edit/Insert mode, I would like to populate my DropDown from an ObjectDataSourc e. The data I need comes from a webservice that I'm calling. I wrapped it into an object that have a function (GetAgentList) that return a datatable.
I usually have no problem using that with SQLDataSource. May be I'm missing something with ObjectDataSourc e
I get a weird error message (see below).
Please let me know if you went thru something similar
Error Message:
System.InvalidO perationExcepti on was unhandled by user code
Message="Databi nding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control."
Source="System. Web"
StackTrace:
at System.Web.UI.P age.GetDataItem ()
at ASP.dispatching groupagent_aspx .__DataBinding_ _control20(Obje ct sender, EventArgs e) in C:\Visual Studio\JustFund raising_Touch\D ispatchingGroup Agent.aspx:line 54
at System.Web.UI.C ontrol.OnDataBi nding(EventArgs e)
at System.Web.UI.W ebControls.List Control.OnDataB inding(EventArg s e)
at System.Web.UI.W ebControls.List Control.Perform Select()
at System.Web.UI.W ebControls.Base DataBoundContro l.DataBind()
at System.Web.UI.W ebControls.Base DataBoundContro l.EnsureDataBou nd()
at System.Web.UI.W ebControls.List Control.OnPreRe nder(EventArgs e)
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.P age.ProcessRequ estMain(Boolean includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)
I have a detailsview that contains templated fields. In the Edit/Insert mode, I would like to populate my DropDown from an ObjectDataSourc e. The data I need comes from a webservice that I'm calling. I wrapped it into an object that have a function (GetAgentList) that return a datatable.
I usually have no problem using that with SQLDataSource. May be I'm missing something with ObjectDataSourc e
I get a weird error message (see below).
Please let me know if you went thru something similar
Code:
'In my DetailsView
<InsertItemTemplate>
<asp:DropDownList ID="DropDownList4" runat="server" DataSourceID="ObjectDataSource1"
DataTextField="user_name" DataValueField="user_id" Width="218px" SelectedValue='<%# Bind("AgentID") %>'>
</asp:DropDownList>
</InsertItemTemplate>
'Of the ObjectDataSource
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetAgentList" TypeName="SugarCRMData">
</asp:ObjectDataSource>
System.InvalidO perationExcepti on was unhandled by user code
Message="Databi nding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control."
Source="System. Web"
StackTrace:
at System.Web.UI.P age.GetDataItem ()
at ASP.dispatching groupagent_aspx .__DataBinding_ _control20(Obje ct sender, EventArgs e) in C:\Visual Studio\JustFund raising_Touch\D ispatchingGroup Agent.aspx:line 54
at System.Web.UI.C ontrol.OnDataBi nding(EventArgs e)
at System.Web.UI.W ebControls.List Control.OnDataB inding(EventArg s e)
at System.Web.UI.W ebControls.List Control.Perform Select()
at System.Web.UI.W ebControls.Base DataBoundContro l.DataBind()
at System.Web.UI.W ebControls.Base DataBoundContro l.EnsureDataBou nd()
at System.Web.UI.W ebControls.List Control.OnPreRe nder(EventArgs e)
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
at System.Web.UI.P age.ProcessRequ estMain(Boolean includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)