By Govinda Berrio - 8/25/2008
Hi,
I'm trying to implement the interfaces to make a third party control (Telerik RadComboBox) bindable to SF business objects.
From what I've gleaned from other messages in this forum, I should look at the source code in the SF DropDownList and copy all the code from there into my subclassed control, correct?
Govinda
|
By Govinda Berrio - 8/25/2008
Sorry, the topic title should read "Implementing IWebBusinessBindable"
|
By Govinda Berrio - 8/26/2008
I just tried copying the SF DropDownList interface implementations for IWebBusinessBindable and IWebListControl. I finally got past a symptom of my inexperience and got the event implementation figured out. But I think I've run into a wall and I think it has to do with Telerik RadComboBox control not having ListControl in it's inheritance hierarchy. The IWebListControl.PopulateList() method relies on the derived class being a sub-class of ListControl. So if this strategy isn't possible, it isn't possible to bind directly to a BO I guess.
Just as a suggestion, and I'm far from an expert, but what if you were to change the first parameter of WebListComob.PopulateCombo() to type IWebListControl instead of ListControl, wouldn't I then be able to pass "this" to it and it would be able to use it. "this" being the new sfRadComboBox : RadComboBox, IWebBusinessBindable, IWebListControl class?
Nevermind, that would probably throw off alot of other code, but if you look at the method's logic you'll see that that parameter is used as an IWebListControl everywhere it's used.
If that's not an option (understandable), what other option do I have?
I would really appreciate any help a developer could give me on this because this seems like a major roadblock to using native SF binding with third party web controls.
Thank You,
Govinda
|
By Dustin Taylor - 8/27/2008
IWebListControl is actually our own interface used for our custom list controls. You don't need to pull that accross to make the telerik control bindable, so that is probably the source of your frustration .By just implimenting IWebBusinessBindable and going through and making sure all the properties that impliment IWebBusinessBindable are properly plumbed, it should expose your custom control to the strataframe binding, which is all you need. So strip out all of the IWebListControll implimentations and properties, and let us know .
|
By Govinda Berrio - 8/27/2008
Thanks Dustin, I'll try that now.
|
By Govinda Berrio - 8/27/2008
Ahhhh... I see now, just implement IWebBusinessBindable and you can set BusinessObjectName and BindingField properties in to bind a property (SelectedValue, Text, etc.) to a BO property. But I have to populate the dropdown with values some other way (I'm using WebBusinessBindingSource), unless I want to implement the IWebListControl.
Attached is the code showing that binding to a third party combobox is pretty much the same as setting up binding to a third party textbox.
Thanks for the help.
|
By Dustin Taylor - 8/27/2008
Yep, it's pretty straight forward .Glad you got it working!
|
By Olivier - 11/1/2012
Govinda Berrio (8/27/2008) Ahhhh... I see now, just implement IWebBusinessBindable and you can set BusinessObjectName and BindingField properties in to bind a property (SelectedValue, Text, etc.) to a BO property. But I have to populate the dropdown with values some other way (I'm using WebBusinessBindingSource), unless I want to implement the IWebListControl.
Attached is the code showing that binding to a third party combobox is pretty much the same as setting up binding to a third party textbox.
Thanks for the help.
Hello
You have some code , to understand How you implement the method in telerik control ?
thanks Olivier,
|
By Govinda Berrio - 11/1/2012
Hi, here is how I subclassed the Telerik RadTextBox using the IWebBusinessBindable interface.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Telerik.Web.UI; using MicroFour.StrataFrame.Business; using MicroFour.StrataFrame.UI; using MicroFour.StrataFrame.UI.Web; using MicroFour.StrataFrame.Extensibility; namespace GKG.WebControls.StrataFrameTelerikWrapper { [ToolboxData("<{0}:sfRadTextBox runat=server></{0}:sfRadTextBox>")] public class sfRadTextBox : RadTextBox, IWebBusinessBindable { #region " Privates " private string _BindingField = ""; private string _BindingProperty = "Text"; private string _BindingFormat = ""; private string _BusinessObjectName = ""; private BindingDirections _BindingDirection = BindingDirections.TwoWay; private string _ErrorMessage = ""; private bool _InError = false; private bool _IgnoreManageUIReadOnlyState = false; #endregion #region " Public Properties " /// <summary> /// The field on the business object to which this control is bound /// </summary> /// <value></value> /// <remarks></remarks> [Category(BusinessMod.EDITOR_CATEGORY), DefaultValue(""), Description(BusinessMod.EDITOR_BINDINGFIELD_DESC), Editor(Constants.TE_WebBindingFieldTypeEditor, typeof(System.Drawing.Design.UITypeEditor))] public string BindingField { get { return _BindingField; } set { _BindingField = value; } } /// <summary> /// The property on the control that is bound to the data on the business object /// </summary> /// <value></value> /// <remarks></remarks> [Category(BusinessMod.EDITOR_CATEGORY), DefaultValue("Text"), Description(BusinessMod.EDITOR_BINDINGPROPERTY_DESC), Editor(Constants.TE_BindingPropertyEditor, typeof(System.Drawing.Design.UITypeEditor))] public string BindingProperty { get { return _BindingProperty; } set { _BindingProperty = value; } } /// <summary> /// The format to display the data when the data is bound to the control. /// </summary> /// <value></value> /// <remarks></remarks> [Description(BusinessMod.EDITOR_WEBBINDINGFORMAT_DESC), Category(BusinessMod.EDITOR_CATEGORY), DefaultValue("")] public string BindingFormat { get { return _BindingFormat; } set { _BindingFormat = value; } } /// <summary> /// The name of the business object on the page to which this control is bound /// </summary> /// <value></value> /// <remarks></remarks> [Category(BusinessMod.EDITOR_CATEGORY), DefaultValue(""), Description(BusinessMod.EDITOR_BUSINESSOBJECT_DESC), Editor(Constants.TE_BusinessObjectNameTypeEditor, typeof(System.Drawing.Design.UITypeEditor))] public string BusinessObjectName { get { return _BusinessObjectName; } set { _BusinessObjectName = value; } } /// <summary> /// Determines whether or not the control's state is automatically managed by the business object /// to which it is bound /// </summary> /// <value></value> /// <remarks></remarks> [Description(BusinessMod.EDITOR_IGNOREMANAGE_DESC), Category(BusinessMod.EDITOR_CATEGORY), DefaultValue(false)] public bool IgnoreManageUIReadOnlyState { get { return _IgnoreManageUIReadOnlyState; } set { _IgnoreManageUIReadOnlyState = value; } } /// <summary> /// Specified whether the data is bound from the control to the data, vice versa, or both. /// </summary> /// <value></value> /// <remarks></remarks> [Category(BusinessMod.EDITOR_CATEGORY), Description(BusinessMod.EDITOR_WEBBINDINGDIRECTION_DESC)] public BindingDirections BindingDirection { get { return _BindingDirection; } set { _BindingDirection = value; } } #endregion #region " Non-Browsable Properties " /// <summary> /// Determines if the control is editable by the user (wraps Control.Enabled) /// </summary> /// <value></value> /// <remarks></remarks> [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool BindingEditable { get { return this.Enabled; } set { this.Enabled = value; } } /// <summary> /// The error message that is displayed when the control is in error /// </summary> /// <value></value> /// <remarks></remarks> [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ErrorMessage { get { return _ErrorMessage; } set { _ErrorMessage = value; } } /// <summary> /// Determines if the control is in error and the error provider should be displayed /// </summary> /// <value></value> /// <remarks></remarks> [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public bool InError { get { return _InError; } set { _InError = value; } } /// <summary> /// Determines whether or not the control has bindings that are in addition to the primary data binding /// </summary> /// <value></value> /// <remarks></remarks> [Browsable(false)] public bool HasAdditionalBindings |
By Olivier - 11/1/2012
Thanks very much,
Can you explain me this ?
: [ToolboxData("<{0}:sfRadTextBox runat=server></{0}:sfRadTextBox>")]
And you SubClasses so DropDownlist or other controls ?
i will try to same thing for the dropdown.
thanks Olivier,
|
By Michel Levy - 11/1/2012
Hello Olivier,
I explain this piece of code (i.e. ToolboxData) in the contrib I wrote last year on the french speaking StrataFrame forum (http://www.strataframe.fr/forum/Topic43.aspx).
It is the code that will be generated on you aspx page when you'll drop this control from the ToolBox on the aspx page.
|
By Olivier - 11/2/2012
Ok thanks Michel
but your topic 43 doesn't exist.
Olivier
|
By Michel Levy - 11/2/2012
clicking on the link takes me on the right page of the french forum. I'll send you the pdf by private mail.
|
By Olivier - 11/2/2012
Thanks michel,
we must to log in , to accass on this link,
excuse me , it's ok.
|
|