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
selvi subramanian
NA
799
574.4k
gridview row is deleted but it show again when we delete the
Jul 27 2014 4:46 AM
if i delete the 1st row in a gridview then am going to delete the 2nd row. if i delete the 2nd row the first row again show.but i need to delete it without affect the database.
my code is
private void BindData()
{
string constr = ConfigurationManager.AppSettings["s"].ToString();
string query = "select Id, Name, Status FROM aten";
SqlDataAdapter da = new SqlDataAdapter(query, constr);
DataSet ds = new DataSet();
DataTable DataTable1 = new DataTable();
da.Fill(DataTable1);
GridView1.DataSource = DataTable1;
GridView1.DataBind();
ViewState["UsingSelectedRow"] = DataTable1;
ViewState["UsingRowDeleting"] = DataTable1;
ViewState["UsingLinkButtonOnClick"] = DataTable1;
}
protected void Delete(object sender, EventArgs e)
{
int index = Convert.ToInt32(((sender as LinkButton).NamingContainer as GridViewRow).RowIndex);
DataTable dt = (DataTable)ViewState["UsingLinkButtonOnClick"];
dt.Rows.RemoveAt(index);
this.GridView1.DataSource = dt;
this.GridView1.DataBind();
}
Reply
Answers (
2
)
https://www.facebook.com/photo.php?fbid=1456982274564488&set
Two comboboxes in connection