[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Capturing CommandField button events.

Posted on 2006-05-23
5
Medium Priority
?
1,178 Views
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..

EDIT  DELETE   NEW

BROWSE

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

Thanks..
0
Comment
Question by:jonatec
  • 2
4 Comments
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 16743682
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
0
 

Author Comment

by:jonatec
ID: 16744383
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 ?
0
 

Author Comment

by:jonatec
ID: 16749575
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;
      }
}



0
 

Accepted Solution

by:
GranMod earned 0 total points
ID: 16778649
Closed, 500 points refunded.

GranMod
The Experts Exchange
Community Support Moderator of all Ages
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

872 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