problem with gridview1_deleted event

  • Thread starter Thread starter André
  • Start date Start date
A

André

Hi,

I have a gridview with Delete button in order to delete a row. When a row is
deleted, i want to count from the table the number of occurence of the value
of a specific field in the deleted. In this example, the field is 'vlg'.
Assume the value of field 'vlg' is '230', then i want to know after having
deleting the row from the gridview, how many times the value '230' remains
in the table.

My problem: this code counts the number of '230' in field 'vlg' not AFTER
the row is deleted but BEFORE the row is deleted.

Is this normal and how to count after the row is deleted?

Thanks

André.

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:enquete %>"
DeleteCommand="DELETE FROM [condition] WHERE [id] = @id" >
<DeleteParameters>
<asp:Parameter Name="id" Type="Int32" />
</DeleteParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" >
.....


Protected Sub GridView1_RowDeleted(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewDeletedEventArgs) Handles
GridView1.RowDeleted
....
connection.Open()
comd.CommandText = "SELECT COUNT(*) from mytable WHERE vlg = 'value
of field vlg in deleted row (here 230)'
nca = comd.ExecuteScalar
end Sub
 
Thanks, you're right: i can see that the row in the gridview is deleted, but
what i meant is that the count must occur after the row is deleted in the
table. But that doesn't happen.
So i also tried with sqldatsource1_deleted, but same thing: the count occurs
before the row is deleted in the table, so counting also the record which is
supposed to be deleted.
 
Hallo Munna,
it's fine when you try to find a solution for a problem.
It would be finer if you go to the end of the still unsolved problem.
Thanks
 
Back
Top