?
Solved

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

Posted on 2007-04-10
4
Medium Priority
?
2,444 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 7

Accepted Solution

by:
here4u247 earned 500 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

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Suggested Courses

777 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