Click here to Skip to main content
15,887,313 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
on button click page loading page load method and browser creates url like below

http://localhost:16767/Index.aspx?ctl00%24ContentPlaceHolder1%24btnDarkblue.x=13&ctl00%24ContentPlaceHolder1%24btnDarkblue.y=20[^]


and not calling buttonclick method

in above url btnDarkblue is button id

If anyone have solution plz reply.
Posted
Updated 26-Feb-19 3:38am
v3
Comments
We have to see the code.
itsathere 4-May-15 2:00am    
<li>
<asp:ImageButton ID="btndBlue" runat="server" OnClick="btnDarkblue_Click" ImageUrl="images/Dark_Blue.jpg"
Width="30" Height="30" /></li>
Is the button inside some other control?
Homero Rivera 2-May-15 10:23am    
Does your button have the property "PostBack" (or something like that) set to true ? I once had something like that.
itsathere 4-May-15 1:51am    
<li>
<asp:ImageButton ID="btndBlue" runat="server" OnClick="btnDarkblue_Click" ImageUrl="images/Dark_Blue.jpg"
Width="30" Height="30" /></li>

There is nothing like that.You can check the button code

Quote:
I did it..Thanks
Just to move from unanswered list.
 
Share this answer
 
Sometimes we cannot trigger the event of the button, you should try to clean the solution, then build it again. In case it still not work, you should add other button to replace it.
 
Share this answer
 
$('#<%=btndBlue.ClientID%>').click(function(event){
    event.preventDefault();
   Then write your code
});
 
Share this answer
 
in page there should be only one FORM ..if your page inherited from some Matser page and content page have also a form, then may be it will create an issue to fire the button click event..
 
Share this answer
 
Comments
Maciej Los 8-May-18 9:19am    
Why to post an answer to already answered and almost 3 years old question?
Just add an onclick event to the button:

Put it in a JS block and give the button an ID:

<button id="btnSubmit" class="float-left submit-button" >Home</button>

<script type="text/javascript">
    document.getElementById("btnSubmit").onclick = function () {
        location.href = "www.yourwebsite.com";
    };
</script>
 
Share this answer
 
Comments
Richard Deeming 26-Feb-19 10:44am    
The OP already solved their problem back in 2015.

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