Using the entity data source control
The entity data source control is your way to data bind your business objects to web controls. You must specify the business object Type you wish to databind against and implement a handler for at least the select method.
Attaching the entity data source:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="EntityDataSource1">
<!-- Columns and whatnot !-->
</asp:GridView>
<cc1:EntityDataSource
ID="EntityDataSource1"
runat="server"
AssemblyName="Example.Entities"
TypeName="Example.Entities.TestCollection"
OnSelect="EntityDataSource1_Select">
</cc1:EntityDataSource>
Implementing the select event:
protected void EntityDataSource1_Select(object sender, NBusiness.Data.Web.SelectEntityEventArgs e)
{
int testId;
if (int.TryParse(Request["t"], out testId) && testId > 0)
{
TestCollection tests = TestCollection.FetchAll();
e.Entity = tests;
}
}
Next:
Configuring NBusiness