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
Sivajihero Hero
NA
105
32.7k
Increment values in gridview column
Dec 29 2015 3:50 AM
In my gridview which is in update mode, I need to increment a column value.
Ex: In my gridview have 5 rows and three columns. I need to increment the serial number column value by 1. Increment Gridview1.Rows[1].Cells[2] value by 1 up to 5th row. But when I execute the code it will result the output put of all the column same. This is my code.
{
int totalRows = GridView1.Rows.Count;
for (int RowIndex = 0; RowIndex < totalRows; RowIndex++)
{
GridViewRow row = GridView1.Rows[RowIndex];
TextBox txtslno = row.FindControl("txtslno") as TextBox;
int number = int.Parse(TextBox5.Text);
if (GridView1.Rows.Count > 1)
{
for (int i = 0; i < GridView1.Rows.Count - 1; i++)
{
txtslno.Text = (number + 1).ToString();
number++;
}
}
}
}
Reply
Answers (
5
)
Dynamically create geofences in windows phone 8.1
double image insert mysql