problem with gridview1_deleted event

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
 
M

Munna

A

André

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.
 
A

André

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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top