Click here to Skip to main content
15,793,624 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I write the code for enter key:
 <script type="text/javascript">
        function fncsave() {
            var k = (event.keyCode ? event.keyCode : event.which);
            //var k = event.keyCode;
            if (parseInt(k) == '13') {
                document.getElementById('<%= imgbtnReply.ClientID %>').click();


and the button click event is:
<asp:ImageButton ID="imgbtnReply" runat="server" ImageUrl="/tmpfimages/member/tmpf00151.png" CssClass="rply_adjst" OnClick="imgbtnReply_Click"  />
       <div class="areaspace"> </div>
       <asp:TextBox ID="txtReply"   CssClass="adtxtbx"  runat="server"  OnKeyPress="fncsave()"></asp:TextBox>

here the button click event didn't fire through javascript.Please assist me better.
Updated 3-Sep-15 22:36pm

1 solution

When you use an imagebutton puts an img tag on the page as well as special javascript that listens for click events and runs its on code when it detects them. Calling any native click event on an image isn't going to trigger the code placed on the page by .net that handles the postback, you'll need to trigger that code yourself.[^]
Share this answer
aiswarjya 4-Sep-15 7:07am    
this code which was i have written that was running perfectly in the page not in modal pop up-

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900