Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Button's onCommand event wont fire

Posted on 2009-02-24
7
Medium Priority
?
1,155 Views
Last Modified: 2012-05-06
Been at this all morning.

I have a Div and a Panel.
--Inside the Div , I have a linkbutton, an ajaxToolkit:ModalPopupExtender and a grid.
--Inside the panel, I have a table and 2 buttons. Cancel and Add. Ajax ModalPopup uses pops up this panel.
-- For the Add button, I have an OnCommand event. In the code behind, I have an event for it.

*** I click on the linkbutton, the modal panel screen pops up. All is good. I click "Add" button BUT the event is not fired. I tried onClick, put debug, but nothing.

*** As a test, I added onClientClick and a test Javascript. THIS WORKS. Javascript alert test pops up.

Not sure why the Button event wont fire. *** NOTE: if I move the panel and the linkbutton and the Ajax control INSIDE the grid, then the event fires. But it should work outside a grid as well.

This is what I have:  It's like the button wont post back.
<div id="pnlOrderNotes" runat="server">
            <fieldset>
                <legend>
                   Order Notes <asp:LinkButton ID="lbAddNote" runat="server" Text="Add Note"/>
                </legend>
                 
              <ajaxToolkit:ModalPopupExtender  BackgroundCssClass="modalBackground"  TargetControlID="lbAddNote" PopupControlID="pnlAddNote"
                                                 ID="ModalPopupExtender1" OkControlID="btnNoteAdd1"  CancelControlID="btnNoteCancel" runat="server">
                    
              </ajaxToolkit:ModalPopupExtender>  
                  <table> 
                          ....
                           <grid>...
-------------------
 
<asp:Panel runat="server" CssClass="modalPanel" Width="50%"  ID="pnlAddNote">
 
<table cellpadding="2" cellspacing="0" border="0" width="100%">
<tr>
              <td>
                <asp:Button ID="btnNoteCancel" runat="server" Text="Cancel" />
              </td>
              <td>
               <asp:Button ID="btnNoteAdd1"   OnCommand="btnNoteAdd1_onClick"   runat="server" Text="Add  " />
              </td>
            </tr>
 
------------------
protected void btnNoteAdd1_onClick(object sender, CommandEventArgs e)
    {

Open in new window

0
Comment
Question by:Camillia
  • 4
  • 3
7 Comments
 
LVL 16

Expert Comment

by:burakiewicz
ID: 23724852
dont set them as the ok and cancel control. just leave them blank
0
 
LVL 16

Accepted Solution

by:
burakiewicz earned 2000 total points
ID: 23724859
<ajaxToolkit:ModalPopupExtender  BackgroundCssClass="modalBackground"  TargetControlID="lbAddNote" PopupControlID="pnlAddNote" ID="ModalPopupExtender1" runat="server"/>
0
 
LVL 7

Author Comment

by:Camillia
ID: 23724913
really? let me see. I hope you're right. Let me try and will post back.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Author Comment

by:Camillia
ID: 23724957
OH MY GOD. YES. YOU'RE RIGHT :)

You're the best. Have spent 5 hours on this. The senior developer didnt know. THANKS.

So, when do i use that ok and cancel??

Kamila.
0
 
LVL 16

Expert Comment

by:burakiewicz
ID: 23725216
i set it once and had that happen to me.
you can set the cancel one if you dont do any processing. it will just close the window.same as calling modalpopup.Hide().  If you set the ok and cancel buttons and want them to do something you can set the onokscript and oncancelscript.
0
 
LVL 7

Author Comment

by:Camillia
ID: 23725258
You saved my day. Thanks so much.

Kamila.
0
 
LVL 16

Expert Comment

by:burakiewicz
ID: 23725273
no prob
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
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…

564 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