none
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.

    Question

  • Some body help me

    I have a problem in binding the two dropdowns in form view control in VWD2005 express edition, i was trying to do this with out writing single line of code.

    I have two drop downs in form view control, ddName1 gets the value from datasource1, and ddName2 gets the values from datasource2 depending upon the selection of ddName1 , if i try this directly with out binding to the  the datasource field that works , but i want to bind the dropdowns to the datasource fields.

    If i try this i get the error message as

    //////////////////////

    Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidOperationException: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.

    Source Error:

    [No relevant source lines]

    Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\testapp\cb8c8183\9416fd1e\App_Web_lhuphy0u.2.cs    Line: 0

    Stack Trace:

    [InvalidOperationException: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.]
       System.Web.UI.Page.GetDataItem() +90
       ASP.default_aspx.__DataBinding__control43(Object sender, EventArgs e) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\testapp\cb8c8183\9416fd1e\App_Web_lhuphy0u.2.cs:0
       System.Web.UI.Control.OnDataBinding(EventArgs e) +80
       System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +12
       System.Web.UI.WebControls.ListControl.PerformSelect() +18
       System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +68
       System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +61
       System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e) +26
       System.Web.UI.Control.PreRenderRecursiveInternal() +88
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5729
    

    ///////////////

    I have gone through many sites,forums but find no required answer as i dont want to implement any coding in this aspect.

    I am pretty confused why microsoft is not looking at this issue.

     

    Friday, December 01, 2006 9:05 PM

All replies

  • Hi,
    What are you binding to what exactly? Can you give an example of values and the what the data source looks like.

    Charles
    Saturday, December 02, 2006 5:10 AM
  • Hi,

    We are using Two Dropdowns in the FormView control that are being populated by different SqlDataSources.

    We have a table Location which is binded to DropDown1 and Table Department which is binded to DropDown2 using SqlDataSource.

    we have set Location DropDown's EnableViewState property to "True". Depending upon SelectedIndexChanged the values in the Department DropDown2 will be populated with the data.

    This can be achieved through coding but that dosn't serve my requirement.

    Our requirement is 0% Coding

    Thanx

     

    Monday, December 04, 2006 1:18 PM
  • I have exactly the same problem, but I haven't seen a solution yet. Have you resolve the problem? Please contact me
    Friday, December 22, 2006 9:23 AM
  • Can you please ask your question on the asp.net forum forums.asp.net. They will be able to help you further.

    Charles

    Friday, December 22, 2006 5:30 PM