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 :)
Did you ever find an easy way to do this?
If you did, can you show me a code sample please?
Thanks.
We are having the same problems with the webcombo binding, have any one found a solution for this?
The answer is that Infrajistics does not support binding, this means that you can not use any infrajistics control inside of a control template. What's strange is that Infragistics does not even plan to include this in any future releses. Note my support response:
Thank you for submitting your query with Infragistics Developer Support via Chat.I have checked the issue in detail. The functionality for which you are looking for is not feasible. There is already a feature request submitted regarding this functionality with the following description:FR09509: Binding Support for WebCombo properties. However if you want this to be implemented in our future releases let me know so that I can create future suggestion on your behalf.Please let me know if I may close this case, or if you have furtherquestions regarding this case.Sincerely,BickyDeveloper Support Engineer
Hello Steve and All,
Indeed, it is a bit different from asp:dropdownlist, since the dropdown of the combobox is essentially grid with columns and SelectedValue needs to work in a different way.
Sorry for that, we will do our best to provide an easier declarative solution soon.
Hi all.
I made a webusercontrol contains webcombo.Maybe It worked fine .But I don't know whether the correct.
sample vb code:
private _value as object
Public Property DataSourceID() As String Implements ICsBindControl.DataSourceID Get Return Me.WebCombo1.DataSourceID End Get Set(ByVal value As String) Me.WebCombo1.DataSourceID = value End Set End Property
Public Property DataTextField() As String Implements ICsBindControl.DataTextField Get Return Me.WebCombo1.DataTextField End Get Set(ByVal value As String) Me.WebCombo1.DataTextField = value End Set End Property
Public Property DataValueField() As String Implements ICsBindControl.DataValueField Get Return Me.WebCombo1.DataValueField End Get Set(ByVal value As String) Me.WebCombo1.DataValueField = value End Set End Property Public Property SelectedValue() As Object Get Return Me.WebCombo1.DataValue End Get Set(ByVal value As Object) Me.WebCombo1.DataValue = value
Me._value = value
End Set End Property
Private Sub WebCombo1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles WebCombo1.DataBound If Me._value IsNot Nothing AndAlso (Me.WebCombo1.DataValue Is Nothing OrElse Me._value <> Me.WebCombo1.DataValue.ToString()) Then Me.WebCombo1.DataValue = Me._value End If End Sub
asp.net code:
<uc1:MyCombo ID="MyCombo1" runat="server" Selectedvalue='<%# Bind("FLD1") %>' DataSourceID="SqlDataSource1" DataValueField="KEYFLD1" DataTextField="NAMEFIELD1" ></uc1:MyCombo>
I agree. That is a serious drawback to what could be a very useful control.
We use Formviews extensively as they speed development, and we had made the assumption that the WebCombo would work with these since the much more primitive dropdown list does.
On the other hand, the dropdown in the UltraWebGrid doesn't bind to a SQLDatasource directly and yet a Webcombo does (and the lowly dropdown makes a lot more sense there).
Very odd.
i'd like to say Im very dissapointed in this lack of feature. please make every effort to make this available in a future relase. i cant believe i have to use the standard asp.net dropdownlist when I just paid for these controls.