How to: Bind a Custom Control type to class public property in Data Source Windows
Step 1: Build your object
public class Machine
{
private string model;
private string id;
private decimal price;
private Part part;
public Machine()
{
part = new Part();
parts = new List();
}
[Bindable(true)]
public string Model
{
get { return model; }
set { model = value; }
}
[Bindable(true)]
public string Id
{
get { return id; }
set { id = value; }
}
[Bindable(true)]
public decimal Price
{
get { return price; }
set { price = value; }
}
[Bindable(true)]
public Part Part
{
get { return part; }
}
}
public class Part
{
private string partId;
public string PartId
{
get { return partId; }
set { partId = value; }
}
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
}
Step 2: Build your UserControl ( for Part object ) [DefaultBindingProperty("Part")]
public partial class PartControl : UserControl
{
private Part m_Part;
public Part Part
{
get { return m_Part; }
set
{
m_Part = value;
if ( !DesignMode && value != null )
partBindingSource.DataSource = value;
}
}
public PartControl()
{
InitializeComponent();
partBindingSource.DataSource = typeof(Part);
txbName.DataBindings.Add ("Text", partBindingSource, "Name");
txbPartID.DataBindings.Add("Text", partBindingSource, "PartId");
}
}
Step 3: Customize the part property to the PartControl * Open Data Source windows
* Select new data source
* Select Machine class
* Select Part property
* Right Click --> Customize --> Open Option Windows
* Select Other
* Select PartControl --> OK
* Select Part Property--> Right-Click--> Select PartControl
* Select Machine-->Right-Click--> Select Details
=================================
Drag and Drop the Machine to the form......
This demo for 1:1 for 1:M use
ComplexBindingProperties or
LookupBindingProperties attribute
I tried to build web custom control that implement IExtenderProvider interface,
with no luck, Until I read the article http://www.codeproject.com/aspnet/PropertyExtendersASP20.asp
Enjoy
טוב יום שישי היום ושוב אני כותבת לכם
עברו שבועים וכמו שחשבתי אף אחד ממכם לא הגיע
כדי להנות מהנחה בחנות ,חבל אתם הפסדתם נגמר המבצע
אני מקווה שבפעם הבאה תהייה תגובה ממכם אנשים
(ולך בן זה נחמד שאתה מגיע למצוא אותנו מהולד נשיקות ממני)
זהו אנשים סוף שבוע טוב לכם תנסו להיות טובים ונדיבים לחיים
ויום אהבה שמח למי שיש לו אהבה
Take look on – http://www.aspxlab.com/
AspxLab Controls 2.6 released. This version introduces two new controls: TabStrip and MultiPage. Also included: improved Visual Studio 2005 designer support and ASP.NET 2.0 data binding support.
I found nice property "EnableSortingAndPagingCallbacks ".
GridView and DetailsView support a special mode for paging and sorting that takes advantage of client-side callbacks to the server to obtain data for the new page or newly sorted data. To enable this feature, set the EnableSortingAndPagingCallbacks property to true.