torsdag 20. august 2009

Using a ObjectDataSource that takes constructors

is simply done by creating the object in the OnObjectCreating event, thanks to this link.


 <asp:ObjectDataSource ID='ObjectDataSource1' runat='server' 

          SelectMethod='GetData' 

          TypeName='BLL' OnObjectCreating='ObjectDataSource1_ObjectCreating'>

</asp:ObjectDataSource>



protected void ObjectDataSource1_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
{
BLL bll = new BLL("arg1",100);
e.ObjectInstance = bll;
}

Ingen kommentarer:

Legg inn en kommentar