Solved

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

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Introduction (All good things must come to an end (http://en.wikipedia.org/wiki/All_Good_Things...))The original MySQL API (http://php.net/manual/en/book.mysql.php) has gone away, deprecated by PHP in Version 5.5, and removed from PHP in all current…
New Relic: Our company recently started researching several products to figure out what were the best ways for us to increase our web page speed and to quickly identify performance problems that we may be having. One of the products we evaluated wa…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

911 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