Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
75
WebCombo doesn't work with Bind("") method in Insert, Update Databound FormView
posted

I want to DataBound a WebCombo placed in FormView like a DropDownList to a field from data source of formview with Bind("") method for Insert, Update with formview. First question is why doesn't have "Edit Databindings" the control in desinger like ASP.NET controls. The second problem is that i have been tried to databound WebCombo in aspx whith Bind() method and gives follow error that i can use this method only for a databound control.  How to databound infragistic controls.

Parents
No Data
Reply
  • 255
    posted

     I'm having the same problem. I have a formview bound to anobjectdatasource like:

     

    <asp:FormView ID="StuffOverview" runat="server" AllowPaging="False" DataKeyNames="Id"
           DataSourceID="StuffDataSource" DefaultMode="ReadOnly">

     

    Inside I want a combobox which is databound to a lookup datasource but also want to bind the selected value (DisplayValue) to this "outer" datasource. Using a asp:dropdown, this works fine:

    <asp:DropDownList ID="Country" runat="server" DataSourceID="CountryListDataSource"
    DataValueField="ISO2LetterCode" DataTextField="CommonName"  SelectedValue='<%# Bind("Country")%>'
    AppendDataBoundItems="true">
    <asp:ListItem Selected="true" Text="N/A" Value="" />

     </asp:DropDownList>

     

    However I when trying the same thing with the WebCombo:

     

    <igWebCombo:WebCombo ID="WebCombo1" runat="server" DataSourceID="CountryListDataSource" DataTextField="ISO2LetterCode" DataValueField="ISO2LetterCode"
    '<%# Bind("Country")%>'>

     

    I get an error: 

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

    System.Web.UI.Page.GetDataItem() +2049170 ASPPage123_aspx.__DataBinding__control30(Object sender, EventArgs e) in c:\Users\Ben\AppData\Local\Temp\Temporary ASP.NET Files\root\37c17faf\4fe8cc99\App_Web_jawtcj7s.0.cs:0 System.Web.UI.Control.OnDataBinding(EventArgs e) +99 Infragistics.WebUI.WebCombo.WebCombo.DataBind() +49 Infragistics.WebUI.WebCombo.WebCombo.Control_Load() +532 Infragistics.WebUI.WebCombo.WebCombo.OnLoad(EventArgs e) +17 System.Web.UI.Control.LoadRecursive() +47 

     

    Is there any way to declaratively databind to a webcombo, i.e. without having to "manually" do it in codebehind?

     

    Thanks 

    Ben

Children