Capturing CommandField button events.

Posted on 2006-05-23
Last Modified: 2012-08-13
Using ASP 2.0 and the CommandField with a bound DetailsView control. I have three buttons set up. I also have a another button control on the form called "browse" that needs to be disabled if the user clicks on the Edit button, ie..



How do I capture an event from the EDIT button and then disable the BROWSE button ?

Question by:jonatec
    LVL 27

    Expert Comment

    use findcontrol method and disable the browse button by when any the edit button is clicked
    or you can use javascript to disable the browse when the edit is pressed.
    if you having problems just post the aspx code and I can set the code for you


    Author Comment

    Where is the click event for the EDIT button to be found for me to write the C# ?
    How do I identify that the EDIT button was clicked ?

    Author Comment

    This is a section of code where I am using a commandField within a DetailsView. I want to disable the "fileUpload" control button when the "EDIT button is clicked:

    <asp:DetailsView       id="dvImages"
                      GridLines="None" >
                    <input      id="fileUpload"
                            style="width:480px; font-weight:bold;"/>
            <asp:CommandField CausesValidation="true"  
                            ShowDeleteButton="True" >
    This is the event that gets called when the EDIT button gets clicked, but I cannot locate the fileUpload control:

    public void detailsView_ModeChanging(object sender, DetailsViewModeEventArgs e)
                case DetailsViewMode.Edit:
                      FileUpload b = dvImages.FindControl("fileUpload") as FileUpload;
                      if (b != null)
                          txtBox.Text = "detailsView_ModeChanging   Found.";


    Accepted Solution

    Closed, 500 points refunded.

    The Experts Exchange
    Community Support Moderator of all Ages

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
    One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on could not pull conte…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    728 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

    20 Experts available now in Live!

    Get 1:1 Help Now