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..

EDIT  DELETE   NEW

BROWSE

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

Thanks..
jonatecAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SammyCommented:
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

Regards
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"
                  DataSourceID="objectDataSourceDetail"
                  CssClass="dvImages"
                  runat="server"
                  AutoGenerateRows="false"
                  DataKeyNames="iRefNo"
                  OnItemCommand="detailsView_ItemCommand"  
                  OnItemInserted="detailsView_ItemInserted"
                  OnItemUpdated="detailsView_ItemUpdated"
                  OnItemDeleted="detailsView_ItemDeleted"
                  OnModeChanging="detailsView_ModeChanging"
                  GridLines="None" >
    <Fields>            
        <asp:TemplateField>
            <ItemTemplate>
                <input      id="fileUpload"
                        type="file"
                        runat="server"
                        onchange="SetImageURL();"
                        style="width:480px; font-weight:bold;"/>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:CommandField CausesValidation="true"  
                        ButtonType="Button"
                        ShowEditButton="True"
                        ShowInsertButton="True"
                        ShowDeleteButton="True" >
        </asp:CommandField>
    </Fields>
</asp:DetailsView>
------------------------------------------------------------------------------------------------------------------------------------
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)
{
      switch(e.NewMode)
      {
            case DetailsViewMode.Edit:
            {
                  FileUpload b = dvImages.FindControl("fileUpload") as FileUpload;
                  if (b != null)
                  {
                      txtBox.Text = "detailsView_ModeChanging   Found.";
                  }
            }
            break;
      }
}



GranModCommented:
Closed, 500 points refunded.

GranMod
The Experts Exchange
Community Support Moderator of all Ages

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.