• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1188
  • Last Modified:

Capturing CommandField button events.

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 ?

  • 2
1 Solution
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

jonatecAuthor Commented:
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 ?
jonatecAuthor Commented:
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.";

Closed, 500 points refunded.

The Experts Exchange
Community Support Moderator of all Ages
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now