It will be much easier to add asp:HiddenField to the ItemTemplate and compare the value for each row.
<asp:HiddenField ID="" runat="server" Value='<%# Eval("blah") %>'></asp:HiddenField>
Now you need to compare this value with the value of the text field in each line of code in this way.
protected void btnUpdate_Click(object sender, EventArgs e) { try { var isAnyRowUpdated = false; foreach (GridViewRow row in gvDetails.Rows) { string strID = ((Label)row.FindControl("lblID")).Text; string strGroup = ((Label)row.FindControl("lblGrp")).Text; string strValue = ((TextBox)row.FindControl("txtValue")).Text; string strOldValue = ((HiddenField)row.FindControl("hdnOldValue")).Value; if (strValue != strOldValue) { isAnyRowUpdated = true;
I hope the code is self explanatory.
source share