Friend rec As integer
Protected Sub GridView1_RowDeleted(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewDeletedEventArgs) Handles
GridView1.RowDeleted
dim a as DictionaryEntry
a = e.Keys(0) 'supposing you're checking the first primary key field
of the current row
'a = e.Values(1) 'supposing you're checking the second non-key field
of the row
'If you don't know the position of the field then you'll need to use a
for each loop
'the field.
if a.Value ="black" then
rec = rec - 1
else
rec=rec-2
end if
Label1.Text = rec
End Sub
[quoted text, click to view] Cas wrote:
> Hello,
>
> My gridview has the option ShowDeleteButton="True".
> There is also a label which renders the amounts of records.
>
> What i'm trying tot do is: when i delete a row, the amount of records must
> be adapted in function of the value of a field.
> If the value of the field="black" then it must be decreased with 1,
> otherwise it must be decreased with 2.
>
> In the code-behind, i started with this, but cant' go further:
>
> Friend rec As integer
> Protected Sub GridView1_RowDeleted(ByVal sender As Object, ByVal e As
> System.Web.UI.WebControls.GridViewDeletedEventArgs) Handles
> GridView1.RowDeleted
> dim a as ??
> a = gridview1. ??? .ToString
> if a="black" then
> rec = rec - 1
> else
> rec=rec-2
> end if
>
> Label1.Text = rec
> End Sub
>
> I guess i use the right event (or is it GridView1_RowDeleting?).
> If you can replace the ?? with the appropriate code, it would be great!
> Thanks
> Cas
Hello,
My gridview has the option ShowDeleteButton="True".
There is also a label which renders the amounts of records.
What i'm trying tot do is: when i delete a row, the amount of records must
be adapted in function of the value of a field.
If the value of the field="black" then it must be decreased with 1,
otherwise it must be decreased with 2.
In the code-behind, i started with this, but cant' go further:
Friend rec As integer
Protected Sub GridView1_RowDeleted(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewDeletedEventArgs) Handles
GridView1.RowDeleted
dim a as ??
a = gridview1. ??? .ToString
if a="black" then
rec = rec - 1
else
rec=rec-2
end if
Label1.Text = rec
End Sub
I guess i use the right event (or is it GridView1_RowDeleting?).
If you can replace the ?? with the appropriate code, it would be great!
Thanks
Cas