Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
WebDataGrid Databinding Flat DataSource

Hi ,

I havent seen any example for Runtime databinding with Relationship based DataSet.I wanna do this scenario in my site.

 I have got Access Database.There is two table with relationship many to one named Products and Categories.So i wanna show my Foreign table's data in a ComboBox include in WebdataGrid.And for CRUD operations i wanna do this manually like getting values from rows and send this values to database. And if ya write me an example for this i will be happy.

So here is my codes;

protected void Page_Load(object sender, EventArgs e)


string conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";

conStr += Server.MapPath("~/App_Data/demo.mdb");

dbCon = new System.Data.OleDb.OleDbConnection(conStr);


if (!Page.IsPostBack)





 private void buildGrid()


string sql;

sql = "SELECT * FROM Products";

System.Data.OleDb.OleDbDataAdapter daSrc = new System.Data.OleDb.OleDbDataAdapter(sql, dbCon);

DataTable oTable1 = new DataTable("Products");


sql = "SELECT * FROM Categories";

daSrc = new System.Data.OleDb.OleDbDataAdapter(sql, dbCon);

DataTable oTable2 = new DataTable("Categories");


DataSet dsSrc = new DataSet();



dsSrc.Relations.Add(dsSrc.Tables["Categories"].Columns["CategoryId"], dsSrc.Tables["Products"].Columns["CategoryId"]);

WebDataGrid1.DataSource = dsSrc;