Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
I have class A
C#
public class A
{
Define properties and methods ...
}

And class B contain A
C#
public clas B
{
A a();
Define properties and methods ...
}

I want to create binding source same on dataset to bind data to control and it able save data to database.
Pls help me!
Thanks all.
Posted

1 solution

u use objectdatasource to bind.

in this there are following properties

1. TypeName= name of class
2. SelectMethod= name of the method of this class by which we get the data.
3.UpdateMethod= name of method of this class by which we update data.
4.InsertMethod,5.DeleteMethod= same as Point 3 for insert and delete data method of class.

VB
<asp:GridView
        id="grd1"
        DataSourceID="ObjectDataSource1"
        Runat="server" />

    <asp:ObjectDataSource
        id="ObjectDataSource1"
        TypeName="ClsDataSource"
        SelectMethod="FillGrid"
        Runat="server" />



C#
public class ClsDataSource
{

  public ClsDataSource()
{
// for connect to dataset
}

public DataTable FillGrid()
{
DataTable dt=new DataTable();
//--- logic for select data

return dt;
}



}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900