TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
SIVA
NA
742
707.4k
How to display the records from the DataRelation class
Dec 22 2011 9:31 AM
Hi All,
i have two tables namely tbl_Department Dno(PK) --Parent
tbl_EmpDept Dno(FK) --child
I have stored both tables in DataSet
nd i have two DataTables namely oDTDept & oDTEmp
i have established the connection between the two tables by using
DataRelation class.
i have one gridview & its bound with tbl_Department table
nd in that DNo is link button if i click the dno its going to the gridview RowCommand event.
my requirement is i have another gridview & i need to bind the childrecords with another grid view.
this is my code can anybody suggest me how can i achieve this
protected
void
gvDept_RowCommand(
object
sender,
GridViewCommandEventArgs
e)
LinkButton
lbtn = e.CommandSource
as
LinkButton
;
DataRelation
oDR =
new
DataRelation
(
"Dept_Emp"
, oDS.Tables[
"tbl_Department"
].Columns[
"DNo"
], oDS.Tables[
"tbl_EmpDept"
].Columns[
"DNo"
],
false
);
foreach
(
DataRow
oDRDept
in
oDS.Tables[
"tbl_Department"
].Rows)
"DNo : "
+ oDRDept[
"DNo"
].ToString() +
" Name : "
+ oDRDept[
"DName"
] +
" Location : "
+ oDRDept[
"Location"
];
foreach
(
DataRow
oDREmp
in
oDRDept.GetChildRows(oDR))
can anybody tel me how can i achieve this
Reply
Answers (
0
)
DataRelation manipulation in Asp.net
Help in login form