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.
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
I'm also wondering why there isn't a "SelectedValue" or a property like that to bind to. A bindable property would select the correct row via the FromKey method on the rows collection and retrieve the selected value via the selectedindex property. This isn't that hard to develop and would save us loads of work when binding in aspx.
Please enlighten us Infragistics :)