Click here to Skip to main content
11,927,190 members (44,294 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET WebForms
I have a Webform in ASP.Net, In this I used DropDownList,TextBox I am Entering some data into this and Using Add Button, Every Added records display in gridView(Not Connected to DataBase), Suppose if their is some mistake in any column while Adding records I want to delete that particular rows only. So could any body will help me to sort out of this problem, what kind of code i have to used, can anybody provide me the code. Thanks in Advance.......

I have used Some code shown below But Sometimes it delete two rows (2nd last and last rows) and some times only one rows...

DataTable dt = (DataTable)Session["additems"];
       if (dt.Rows.Count > 0)
       Session["additems"] = dt;
Posted 21-Mar-12 20:45pm
Namit KB1.3K
Edited 21-Mar-12 20:47pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
     dt = (DataTable)ViewState["dt"];
     GridView1.DataSource = dt;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.151126.1 | Last Updated 22 Mar 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100