My application have two tables,I want to display both tables data on single Gridview
And update ,delete that data
Is this Possible? How?
Asp.net GridView & ado.net
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Subhendu DeRank #1,108 · 1.7K reputationPosted Jan 2, 2011, 12:12 AM EST
Step 1 -> you populate DataTable1(DT1)
Step 2 -> you populate DataTable2(DT2)
Step 3 -> Join these two tables and create DataTable3(DT3).
Step 4 -> Suggest you to create one extra column(col1) in both the tables(DT1 & DT2) that will contain the tablename in the DT3.
Step 5 -> Bind DT3 with gridview and make col1 invisible.
Step 6 -> Add EditCommand & DeleteCommand to the gridview.
Step 7 -> For EditCommand & DeleCommand event handler, you have access to the column col1 from which you can build the sql and execute it.
I didn't try it but it seems it will work. If you find any difficulties to implement it, let me know. I will definitely help you out.
Sam HobbsRank #107 · 20.5K reputationPosted Jan 2, 2011, 9:48 AM EST
Is there a one-for-one correspondence of records in both tables? If not, then is one table used like a lookup table that does not get updated? If there is the same number of records, then are you updating data in both tables? This last question probably is not important but it is best to answer it anyway.
PankaJ D147 reputationPosted Jan 2, 2011, 6:41 PM EST
qmaster-> id(pk), que,op1,op2,op3,op4,asn,status
qdetails -> id(fk),qtype,qtechonoly,level
I want to update , delete both table data on single gridview , or suggest me onother option.