DataGridView - Determine if a row has been edited

Discussion in 'ASP .Net' started by Guest, Apr 20, 2006.

  1. Guest

    Guest Guest

    I have a Datagridview.
    I only edit couple of columns.
    No new rows are added.
    I need to know the count of "rows" that were modified.
    how do I acheive this?
     
    Guest, Apr 20, 2006
    #1
    1. Advertisements

  2. Guest

    Guest Guest

    You might want to update and store a counter variable in the ViewState or the
    Session upon each successful update (which marks an Edit).

    For example if you were using SqlDataSource object with your GridView then
    you might handle the SqlDataSource.Updated event:

    Protected Sub SqlDataSource_Updated(sender As Object, e As
    SqlDataSourceStatusEventArgs)
    If e.AffectedRows > 0 Then
    dim iCounter as Integer
    If Not ViewState("RecordsEditedCounter") Is Nothing Then
    iCounter= ViewState("RecordsEditedCounter") + 1
    Else
    iCounter = 1
    End If
    ViewState("RecordsEditedCounter")= iCounter
    End If
    End Sub
     
    Guest, Apr 20, 2006
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.