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
Parameswari bera
NA
19
4.7k
In GridView i wanted to delete the row by using checkbox
Mar 5 2015 12:52 AM
Hi
protected void btnDelete_Click(object sender, EventArgs e)
{
//Loop through all the rows in gridview
foreach (GridViewRow GridViewrow in GridView1.Rows)
{
//Finiding checkbox control in gridview for particular row
CheckBox chkdelete = (CheckBox)GridViewrow.FindControl("chkdelete");
//Condition to check checkbox selected or not
if (chkdelete.Checked)
{
//Getting UserId of particular row using datakey value
int Sno = Convert.ToInt32(GridView1.DataKeys[GridViewrow.RowIndex].Value);
SqlDataSource1.DeleteParameters["Sno"].DefaultValue =Sno.ToString();
SqlDataSource1.Delete();
}
when i wanted to execute this one getting this error:
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
Reply
Answers (
2
)
How to show headers in Gridview while Scrolling down ?
what is PE file in context of .net?