acadia
acadia

Reputation: 2333

ASP.net Button Server Side click not firing

I have a ASP.net button btnAccept in a panel control which will be shown on Click of Another button in a modalViewextender control.

The btnAccept control onclick is not firing. But if I put onClientClick it is firing. But I want to work onClick at the server end. I am not getting any errors and I am not able to figure this out.

Any help will be greatly appreciated.

Below is the code for the button

<cc1:ModalPopupExtender ID="mdldigiSign" runat="server" Enabled="True" 
    BackgroundCssClass="modalBackground" TargetControlID="pnlSign" 
    PopupControlID="pnlSign" CancelControlID="lblCloseSign"
    OnCancelScript="hideDigiSignDialog();" DynamicServicePath="">
</cc1:ModalPopupExtender>
<asp:Panel ID="pnlSign" runat="server">
    <table border="0" class="SubMenu" align=center >
        <tr>
            <td align="right" valign="top" style="height: 30px">
                <label id="lblCloseSign" runat="server" title="Close">
                    <a href="#">
                        <img src="images/close_button.gif" border="0" 
                                alt="Close" />
                    </a>
                </label>
            </td>
        </tr>
        <tr><td>Respondent's Signature</td></tr>
        <tr>
            <td align=center >
                <OBJECT id=esCapture1 
                    classid=clsid:84C046A7-4370-4D91-8737-87C12F4C63C5 
                    width="150" height="80" codebase="websignax.cab" VIEWASTEXT>
                    <param name="useslibrary" value="websignAx">
                    <param name="useslibrarycodebase" value="websignax.cab">
                    <param name="useslibraryversion" 
                        value="7,1,0,1">IntegriSign Signature Control
                </OBJECT>
                <br />
                <br />
                <INPUT onclick=signNow() type=button value="StartSign" 
                    name=B1 id=B1>
                &nbsp;&nbsp;
                <input type="button" value="GetData" name="B2" 
                    onclick=getData()>
                <br />
                <asp:HiddenField ID="hdsignature" runat=server />
            </td>
        </tr>
        <tr>
            <td  align="center">
                <asp:Button ID="btnAccept" runat="server" 
                    Text="Accept Settlement"  /> 
            </td>
        </tr>
    </table>
</asp:Panel>

Thanks

Upvotes: 5

Views: 4214

Answers (4)

RickNZ
RickNZ

Reputation: 18652

  1. Your <asp:Button> control doesn't have an OnClick handler assigned.
  2. You do have OnClick handlers assigned for the <input> tags, but that won't work; first, any tags that invoke server-side actions must have runat="server" set; second, you should use a <asp:TextBox> control instead.

Upvotes: 1

JB King
JB King

Reputation: 11910

I wonder if you may be running into a problem with doing too many things on the client side that your view state is becoming invalid and that is what is blocking the server side call from firing.

Intermittent Invalid Viewstate Error in ASP.NET Web pages may also help. Have you confirmed that there is a request getting to the server?

Upvotes: 0

Steve
Steve

Reputation: 11

Probably the page directive hast this setting: eventwireup="false". If this is true the event will not fire.

As womp already said - would be helpfull to see the code. Could you include the page directive in your posting?

Upvotes: 1

womp
womp

Reputation: 116987

Without seeing any code (which would really help us), I'm going to guess that you are dynamically adding your btnAccept to the page, and not recreating it properly on the postback.

If you're not creating btnAccept during the Init phase of the lifecycle, then you'll have to track its ViewState manually. If you're not creating it until PreRender(), then you'll be past the point at which event handlers have fired.

If you post some code it would be a lot easier to diagnose.

Upvotes: 4

Related Questions