Solved

How to detect clicking of "cancel" link on ASP.NET 2.0 detailsview object. VBScript.

Posted on 2007-04-10
4
2,419 Views
Last Modified: 2013-11-07
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!
0
Comment
Question by:carled
  • 2
  • 2
4 Comments
 
LVL 7

Accepted Solution

by:
here4u247 earned 125 total points
ID: 18881283
hey bud,

on your itemcommand event, you can check if the event fired is cancel, e.g.  e.commandname="cancel"

...
...
        Select Case e.CommandName
            Case "Cancel"
                'Do Something here
                GridUnitsOut.EditIndex = -1 'edit mode
        End Select
0
 
LVL 1

Author Comment

by:carled
ID: 18881307
Whoa... what's an itemcommand event?
0
 
LVL 1

Author Comment

by:carled
ID: 18881336
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... :-)
0
 
LVL 7

Expert Comment

by:here4u247
ID: 18881343
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="MyDetailsView_ItemCommand"
            ....>

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 DetailsViewCommandEventArgs)
   
        ' 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



0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
This video teaches users how to migrate an existing Wordpress website to a new domain.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now