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
divya
NA
186
111.9k
How to Clear DataGridView Rows?
Jul 13 2012 8:23 AM
Hai Guys..
In My application for a gridview Some rows are binded from database and remaining rows are added statically by using the below given code..
DataGridViewColumn col2 = new DataGridViewColumn();
DataGridViewCell cell2 = new DataGridViewTextBoxCell();
col2.CellTemplate = cell2;
col2.HeaderText = "No of Days";
col2.Name = "No of Days";
col2.Visible = true;
col2.Width = 40;
if (dgvEmployeeSalary.Columns.Contains("No of Days") == true)
{
}
else
{
dgvEmployeeSalary.Columns.Add(col2);
}
//dgvEmployeeSalary.Columns.Add(col2);
foreach (DataGridViewRow row in dgvEmployeeSalary.Rows)
{
if (row.Cells["Employee ID"].Value != null)
{
row.Cells["No of Days"].Value = txtNoofWorkingDays.Text;
}
}
I tried dgvEmployeeSalary.datasource=null
its working but while trying to rebind data gridview ,then column index is changing..
can any one help me...
Reply
Answers (
4
)
problem while inserting to access database
Difference DateValues