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
Jes Sie
744
1.2k
282.2k
Three Tier Structure (from code behind to data access)
Mar 5 2018 1:18 AM
Hello everyone, I created an xml file from a gridview (thanks to Rakesh article). My application is done using a 3 tier structure. How will I transfer my code behind to data access and call only the xml from my code behind? Please see code below.
StringBuilder sbSubjects =
new
StringBuilder();
sbSubjects.AppendLine(
"<?xml version=\"1.0\" ?>"
);
foreach
(GridViewRow row
in
GridView1.Rows)
{
Label SubjectID = (Label)row.FindControl(
"lblSubjectId"
);
string
lblEnrollmentId = lblEnrollmentID.Text.Trim();
if
(SubjectID ==
null
|| lblEnrollmentId ==
null
)
{
return
;
}
if
(
string
.IsNullOrEmpty(SubjectID.Text.Trim()) ||
string
.IsNullOrEmpty(lblEnrollmentId))
{
return
;
}
else
{
sbSubjects.AppendLine(
"<tblEnrolledSubjects>"
);
sbSubjects.AppendLine(
" <subjects>"
);
sbSubjects.AppendLine(
" <SubjectId>"
+ SubjectID.Text.Trim() +
"</SubjectId>"
);
sbSubjects.AppendLine(
" <EnrollmentID>"
+ lblEnrollmentId +
"</EnrollmentID>"
);
sbSubjects.AppendLine(
" </subjects>"
);
sbSubjects.AppendLine(
"</tblEnrolledSubjects>"
);
}
}
SqlCommand cmdSubjects =
new
SqlCommand(
"[dbo].[spInsert_XML_BulkEnrollmentSubjects]"
, con, transaction);
cmdSubjects.CommandType = CommandType.StoredProcedure;
cmdSubjects.Parameters.AddWithValue(
"@SubjectsData"
, sbSubjects.ToString());
Reply
Answers (
4
)
url writing in global.asax
onchange event for dropdown list