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
sandeep kodepaka
NA
106
210.4k
How to Add rows Dynamically to GridView
Jan 4 2011 4:14 AM
Hi team
Can anyone tell me how we can add rows dynamically in gridview.
DataTable
dt =
new
DataTable
();
try
{
CheckBox
chk =
new
CheckBox
();
foreach
(
GridViewRow
row
in
gvDept.Rows)
{
chk = (
CheckBox
)row.FindControl(
"ChkDept"
);
if
(chk.Checked ==
true
)
{
Label
lbl = (
Label
)row.FindControl(
"lblcode"
);
string
code = lbl.Text;
dt = BLSht.GetEmployeeListAsPerDept(code);
if
(dt.Rows.Count>0)
{
DataRow
newRow = dt.NewRow();
gvAppEmployees.DataSource = dt;
}
else
{
}
}
else
{
}
}
gvAppEmployees.DataSource = dt;
gvAppEmployees.DataBind();
}
catch
(
Exception
ex)
{
}
}
Reply
Answers (
2
)
Save file dialog box
upadating record in gridview