Implementing IWebBusiness


Author
Message
Govinda Berrio
Govinda Berrio
StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)
Group: StrataFrame Users
Posts: 94, Visits: 481
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
Govinda Berrio
Govinda Berrio
StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)
Group: StrataFrame Users
Posts: 94, Visits: 481
Sorry, the topic title should read "Implementing IWebBusinessBindable"
Govinda Berrio
Govinda Berrio
StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)
Group: StrataFrame Users
Posts: 94, Visits: 481
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
Dustin Taylor
Dustin Taylor
StrataFrame Team Member (652 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
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 Hehe.

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 Smile.

Govinda Berrio
Govinda Berrio
StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)
Group: StrataFrame Users
Posts: 94, Visits: 481
Thanks Dustin, I'll try that now.

Govinda Berrio
Govinda Berrio
StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)
Group: StrataFrame Users
Posts: 94, Visits: 481
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.

Dustin Taylor
Dustin Taylor
StrataFrame Team Member (652 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
Yep, it's pretty straight forward Smile.

Glad you got it working!

Olivier
Olivier
StrataFrame User (324 reputation)StrataFrame User (324 reputation)StrataFrame User (324 reputation)StrataFrame User (324 reputation)StrataFrame User (324 reputation)StrataFrame User (324 reputation)StrataFrame User (324 reputation)StrataFrame User (324 reputation)StrataFrame User (324 reputation)
Group: StrataFrame Users
Posts: 96, Visits: 805
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,

==============================================
Asp.net C# - Strataframe - telerik
==============================================
Govinda Berrio
Govinda Berrio
StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)StrataFrame User (240 reputation)
Group: StrataFrame Users
Posts: 94, Visits: 481
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
        {
            get { return false; }
        }
#endregion

    }
}

Olivier
Olivier
StrataFrame User (324 reputation)StrataFrame User (324 reputation)StrataFrame User (324 reputation)StrataFrame User (324 reputation)StrataFrame User (324 reputation)StrataFrame User (324 reputation)StrataFrame User (324 reputation)StrataFrame User (324 reputation)StrataFrame User (324 reputation)
Group: StrataFrame Users
Posts: 96, Visits: 805
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,


==============================================
Asp.net C# - Strataframe - telerik
==============================================
Edited 12 Years Ago by Olivier
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search