carled
asked on
How to detect clicking of "cancel" link on ASP.NET 2.0 detailsview object. VBScript.
How do I detect user clicking on "cancel" on ASP.NET 2.0 DetailsView object standard "insert/cancel" bar? I'm a classic asp developer and I haven't yet got my head around the new technology for all this! The DetailsView object has an ID of "AcInsert". I cannot find any relevant event to attach to in the events list, so I'm stumped... I presume it'll be something like finding the right eventhandler and looking for AcInsert.cancelClicked() having happened or something like that?
VBScript developer, so no C/C# please!
VBScript developer, so no C/C# please!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Forget it - looked it up, now I see! Easy when you get your head around it, it's just soooooooo different to vanilla asp... and it does so much of the work for you, i you know how to ask it nicely... :-)
basically, the DetailsView have OnItemCommand event handler which deals with commands/button is fired, so in your details view you need to specify which method will handle this event, i.e.:
DetailsView ItemCommand Example</h3>
<asp:DetailsView
....
OnItemCommand="MyDetailsVi ew_ItemCom mand"
....>
also make sure if you specified the cancel button that it should look something like:
<asp:ButtonField CommandName="Cancel" Text="Cancel" />
Event handelry code:
Sub MyDetailsView_ItemCommand( ByVal sender As Object, ByVal e As DetailsViewCommandEventArg s)
' Use the CommandName property to determine which button
' was clicked.
Select Case e.CommandName
Case "Cancel"
'Do Something here
MyDetailsView.EditIndex = -1 'edit mode
End Select
End Sub
DetailsView ItemCommand Example</h3>
<asp:DetailsView
....
OnItemCommand="MyDetailsVi
....>
also make sure if you specified the cancel button that it should look something like:
<asp:ButtonField CommandName="Cancel" Text="Cancel" />
Event handelry code:
Sub MyDetailsView_ItemCommand(
' Use the CommandName property to determine which button
' was clicked.
Select Case e.CommandName
Case "Cancel"
'Do Something here
MyDetailsView.EditIndex = -1 'edit mode
End Select
End Sub
ASKER