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
mohammed shamsheer
NA
394
143.9k
Message=Index was out of range. Must be non-negative and le
Jul 6 2013 1:54 AM
edit the selected row in gridview and focus remain on selection
error : Message=Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
private void btnEdit_Click(object sender, EventArgs e)
{
int id = Convert.ToInt32(grdShow.SelectedRows[0].Cells[0].Value.ToString());
object[,] ObjEditProductDetails = new object[,] { {"@ProductId",id},{ "@ProductName", txtProductName.Text }, { "@Manufacturer", txtManufactorer.Text }, { "Rate",txtRate.Text } };
DB.ExecuteNonQuery_SP("Sp_UpdateProductDetails",ObjEditProductDetails);
int RowIndex = 0;
if (grdShow.Rows.Count > 0)
{
RowIndex = grdShow.SelectedRows[0].Index;
}
ShowGridView();
grdShow.SelectedRows[RowIndex].Selected = true;
ClearControls();
}
Reply
Answers (
1
)
Remote Coding in DotNet
regarding clicking a button in windows forms