Solved

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

Posted on 2007-04-10
4
2,435 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 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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Foreword (May 2015) This web page has appeared at Google.  It's definitely worth considering! https://www.google.com/about/careers/students/guide-to-technical-development.html How to Know You are Making a Difference at EE In August, 2013, one …
A publishing tool, a Version Control System, or a Collaboration Platform! These can be some of the defining words for the two very famous web-hosting Git repositories: Bitbucket and Github. Git is widely used amongst the programmers and developers f…
This video teaches users how to migrate an existing Wordpress website to a new domain.
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

733 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