when we click on datagridview edit button all the records show in my textboxes and tick on check boxes now what i want if user click on update button without any changes how can we campare if user changes or not.
when we click on edit button all information store in "detail"
Superguppie.
Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
When all you've got is a Hammer, Every Problem looks like a Nail. Michael Swain.
zohaibak
Member
11 Points
103 Posts
compare data
May 17, 2012 04:41 AM|LINK
my question is that
when we click on datagridview edit button all the records show in my textboxes and tick on check boxes now what i want if user click on update button without any changes how can we campare if user changes or not.
when we click on edit button all information store in "detail"
ViewState["detail"] = DTable;
TimoYang
Contributor
3732 Points
1275 Posts
Re: compare data
May 17, 2012 04:49 AM|LINK
Plz change your fields to template mode first, and then handle GridView_RowUpdating, and then compare manually:
e.OldValues["fieldname"]
with
e.NewValues["fieldname"]
if equals, plz use:
e.Cancel = true;
zohaibak
Member
11 Points
103 Posts
Re: compare data
May 17, 2012 04:52 AM|LINK
do you have some code
TimoYang
Contributor
3732 Points
1275 Posts
Re: compare data
May 17, 2012 04:59 AM|LINK
Handle the GridView_RowUpdating event and put my codes there……
superguppie
All-Star
48225 Points
8679 Posts
Re: compare data
May 21, 2012 09:04 AM|LINK
How do you DataBind your GridView? Through a DataSource Control, or in code-behind?
If you are doing it in code-behind, what version of ASP.NET are you using? (4.0 is a lot more friendly than previous versions for this.)
Do you mean your entire GridView goes into Edit mode? Or just a single row at a time?
For an example on the use of the RowUpdating handler, see the msdn page for it.
Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
When all you've got is a Hammer, Every Problem looks like a Nail. Michael Swain.
amit.jain
Star
11225 Points
1815 Posts
Re: compare data
May 21, 2012 09:17 AM|LINK
protected void btnUpdate_Click(object sender, EventArgs e) { originalTable = (DataTable)ViewState["originalValues"]; foreach (GridViewRow row in GridView1.Rows) if(IsRowModified(row)) { GridView1.UpdateRow(row.RowIndex,false); } tableCopied = false; GridView1.DataBind(); }refer for more info http://csharpdotnetfreak.blogspot.com/2009/05/edit-multiple-records-gridview-checkbox.html
amiT jaiN
ASP.NET C# VB Articles And Code Examples