Intersoft WebCombo Documentation
DataSource Property
See Also  Send Feedback
ISNet.WebUI.WebCombo Namespace > WebCombo Class : DataSource Property






Specifies the datasource object which the control bind to. Specifies the datasource object which the control bind to.

Syntax

Visual Basic (Declaration) 
<DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)>
<DefaultValueAttribute()>
<CategoryAttribute("Data")>
<DescriptionAttribute("Specifies the datasource object which the control bind to.")>
<BindableAttribute(Bindable=True, Direction=BindingDirection.OneWay)>
Public Overridable Property DataSource As Object
Visual Basic (Usage)Copy Code
Dim instance As WebCombo
Dim value As Object
 
instance.DataSource = value
 
value = instance.DataSource
C# 
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
[DefaultValueAttribute()]
[CategoryAttribute("Data")]
[DescriptionAttribute("Specifies the datasource object which the control bind to.")]
[BindableAttribute(Bindable=true, Direction=BindingDirection.OneWay)]
public virtual object DataSource {get; set;}
Delphi 
public read-write property DataSource: TObject; virtual; 
JScript 
DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)
DefaultValueAttribute()
CategoryAttribute("Data")
DescriptionAttribute("Specifies the datasource object which the control bind to.")
BindableAttribute(Bindable=, Direction=BindingDirection.OneWay)
public function get,set DataSource : Object
Managed Extensions for C++ 
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
[DefaultValueAttribute()]
[CategoryAttribute("Data")]
[DescriptionAttribute("Specifies the datasource object which the control bind to.")]
[BindableAttribute(Bindable=true, Direction=BindingDirection.OneWay)]
public: __property virtual Object* get_DataSource();
public: __property virtual void set_DataSource( 
   Object* value
);
C++/CLI 
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
[DefaultValueAttribute()]
[CategoryAttribute("Data")]
[DescriptionAttribute("Specifies the datasource object which the control bind to.")]
[BindableAttribute(Bindable=true, Direction=BindingDirection.OneWay)]
public:
virtual property Object^ DataSource {
   Object^ get();
   void set (    Object^ value);
}

Remarks

One of WebCombo.NET key features is its ability to use the common DataSource and DataBind method for data binding purpose.

WebCombo.NET has been specially designed to bring a new web experience when selecting from a large dropdown rows and also meet the .NET infrastructure requirement needed by developers.

DataSource property can be assigned from anywhere in the code. It supports all ADO.Net objects, means that you have all the flexibility to use custom classes that returns a DataSet object, stored procedures, Oracle source and so on.

By assigning a DataSource, you are all set and the WebCombo control is ready to use. WebCombo control is built with automatic query handler. That means you do not have to create another stored procedure to match with the control's infrastructure. Instead, WebCombo's automatic query handler will do all required lookups and filtering process.

WebCombo.NET v3.0 supports even more data source types including SqlDataReader, OleDbDataReader, Xml data source and any objects that implement IEnumerable such as Collections or ArrayList. The feature works perfectly in conjunction with AutoQueryHandler, this allow developers to use non-DataSet objects as datasource while having query automatically handled by WebCombo.

WebCombo.NET v4.0 allows you to perform codeless data binding through DataSourceControl support. You can configure the datasource, its connection and its related property without writing codes.
Declaratively, you can create a WebCombo instance and bind it to a table in your Sql database in two simple statements as in the following:

<ISWebCombo:WebCombo ID="WebCombo1" runat="server"
UseDefaultStyle="True" Width="200px" Height="20px"
DataSourceID="SqlDataSource1" DataTextField
="ActivityName"
DataValueField="ActivitiesId">
</ISWebCombo:WebCombo>

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DbConnectionString %>"
SelectCommand="SELECT * FROM [Activities]">
</asp:SqlDataSource>

From the statements above we can see the WebCombo1 is bound to a datasource control through DataSourceID property. The WebCombo connects to the specified datasource control and display data from the datasource available in SqlDataSource1.

WebCombo.NET v4.0 still support older databinding mechanism through InitializeDataSource or DataSource property set in code behind.

The benefits of the new datasource control binding support: 

  • Improved developers' productivity through codeless, simple and hassle-free databinding. 
  • Cleaner separation between User Interface and Data Access/Business Layer codes. All data layer codes and logics are now handled at datasource control level instead of component level. That means UI component such as WebCombo is now purely serving as data selector and combobox function, and no longer handling datasource. 
  • Better architecture. For more than decades, developers have struggled to find the best pattern in developing databound application. Datasource control binding concept is one of the most appealing and acceptable mechanism recognizing its cleaner separation between user interface and data access layer. 
  • Highly reusable. Datasource control offers better reusability since it has rock solid architecture. For instance, developer can write business layer codes in application level which is used throughout the application and use ObjectDataSource to connect to the business layer function.
  • Extensible. Datasource control such as ObjectDataSource and ISDataSource (Intersoft’s proprietary multi-views datasource control) has ability to connect to custom business layer codes. You can also connect the controls to DataSet and TableAdapter that generated using Visual Designer in Visual Studio 2005, as well as connect it to extended function that you write in an extended class through new “partial class” mechanism.

Some important things that developers need to pay attention regarding the new datasource control concept:

  • InitializeDataSource event is no longer fired when the WebCombo is bound to DataSourceID. This event will still be fired normally when the DataSourceID property is empty (old databinding mode).
  • You can not bind to datasource control and datasource object at the same time. For instance, if you set DataSourceID to SqlDataSource1 and at the same time set WebCombo1.DataSource = dsNorthWind.Customers in the code, this will throw an invalid operation exception.
  • Flat-view datasource controls that come with ASP.NET 2.0 are all supported. This includes SqlDataSource, AccessDataSource and ObjectDataSource.
  • All internal operations and existing functions in WebCombo.NET are still working properly with the new datasource control binding. This ensures full compatibility in behaviors and functions with the previous versions.
  • Data caching. In pre-2007 platform, Intersoft’s databound control such as WebCombo.NET and WebGrid.NET Enterprise employs built-in automatic data caching mechanism. In 2007 product lines, the built-in data caching is no longer functioning when the control is bound to datasource control. If you want to configure caching, please refer to the capability of the datasource control that you used to bound to the control. For instance, if you bind a WebCombo control to SqlDataSource, then you can enable the caching by setting EnableCaching of the SqlDataSource control to True.

To learn more about how to bind WebCombo to AccessDataSourceControl and ObjectDataSourceControl, please read Walkthrough: Binding WebCombo to AccessDataSource control and Walkthrough: Binding WebCombo to ObjectDataSource control.

 

Advanced Load-on-Demand data retrieval through ISDataSourceControl support

ISDataSource control is Intersoft's proprietary data source control that extends ObjectDataSource functionalities with hierarchical business object binding and automatic load on demand integration.

In previous versions of WebCombo.NET, data retrieval is handled at component level. The load-on-demand mechanism is also handled at component level, for instance, at WebCombo level. This is required because both user interface and data handling are mixed. With the new datasource control support in version 4.0, WebCombo can connect to ISDataSource control as well since ISDataSource implements the datasource control standards and interfaces.

The load-on-demand data retrieval in WebCombo.NET version 4.0 can be used when bound to datasource control. However, the currently supported datasource control for this operation is ISDataSource control only.

When bound to ISDataSource and AllowAutoQueryHandler of WebCombo is set to False, the WebCombo will connect to special method available in the specified Select method property of ISDataSource control. For instance, if the Select method property is set to GetData, then you required to create one method with name GetData with 3 parameters, and one get count method with 1 parameter. The detailed signature is as following:

public DataTable GetData(int maximumRows, int startRowIndex, string queryText) public int SelectCount(string queryText)

The supplied methods allow the datasource control to reuse it in other pages, and thus providing higher level of usability. This concept also enables user interface components to interact with datasource in consistent fashion through datasource control.

To learn more about how to use load-on-demand feature using ISDataSourceControl, please read Walkthrough: Using load-on-demand data retrieval with ISDataSource control in WebCombo.

Walkthrough: Binding WebCombo to ISDataSource control.

Walkthrough: Binding multiple WebCombo instances to ISDataSource control.

One of WebCombo.NET key features is its ability to use the common DataSource and WebCombo.DataBind method for data binding purpose.

WebCombo.NET has been specially designed to bring a new web experience when selecting from a large dropdown rows and also meet the .NET infrastructure requirement needed by developers.

DataSource property can be assigned from anywhere in the code. It supports all ADO.Net objects, means that you have all the flexibility to use custom classes that returns a DataSet object, stored procedures, Oracle source and so on.

By assigning a DataSource, you are all set and the WebCombo control is ready to use. WebCombo control is built with automatic query handler. That means you don't have to create another stored procedure to match with the control's infrastructure. Instead, WebCombo's automatic query handler will do all required lookups and filtering process.

This version of WebCombo supports even more data source types including SqlDataReader, OleDbDataReader, Xml data source and any objects that implement IEnumerable such as Collections or ArrayList. The feature works perfectly in conjuction with AutoQueryHandler, this allow developers to use non-DataSet objects as datasource while having query automatically handled by WebCombo.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2012 Intersoft Solutions Corp. All Rights Reserved.