DataSource. Please, need some help.

S

shapper

Hello,

I am using a LinqDataSource but I could either use an SQLDataSource or
any other. The question is the same:

The DataSource is associated with a GridView and I have the following
event:

' lds_Deleting
Private Sub lds_Deleting(ByVal sender As Object, ByVal e As
LinqDataSourceDeleteEventArgs) Handles lds.Deleting

End Sub

When I click a row in the GridView this event is fired.
I am creating a custom Linq code to delete a record but I need the
RecordId (PK) of the row clicked.

How can I get that value in my Deleting event?

Thanks,
Miguel
 
B

Barrie Wilson

shapper said:
Hello,

I am using a LinqDataSource but I could either use an SQLDataSource or
any other. The question is the same:

The DataSource is associated with a GridView and I have the following
event:

' lds_Deleting
Private Sub lds_Deleting(ByVal sender As Object, ByVal e As
LinqDataSourceDeleteEventArgs) Handles lds.Deleting

End Sub

When I click a row in the GridView this event is fired.
I am creating a custom Linq code to delete a record but I need the
RecordId (PK) of the row clicked.

How can I get that value in my Deleting event?

maybe this helps (example from the VS2008 docs):

Protected Sub LinqDataSource_Deleting(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.LinqDataSourceDeleteEventArgs)
Dim product As Product
product = CType(e.OriginalObject, Product)

If (product.OnSale And Not confirmCheckBox.Checked) Then
e.Cancel = True
End If
End Sub
 

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,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top