Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why any html button cause postback in aspx page?

I have created .aspx page on my SharePoint site and inserted within the page HTML button.

Example

    <PublishingWebControls:editmodepanel PageDisplayMode="Display" runat="server" SuppressTag="True">
...
<button>Click Me!</button>
...
</PublishingWebControls:editmodepanel>

Every time I hit 'Click Me!' the post back occurs. This is not my desired behavior, but I have found a way how to not cause post backs. I added javascript code to onclick property <button onclick='return false;'>Click Me!</button>

My question is, why the post back occurs, even if the button does not contain type="submit" property?

I checked also master page, which contains <form runat="server"> and wraps all the content and there is also no action="page.aspx" property.

like image 877
mimo Avatar asked Aug 01 '13 13:08

mimo


1 Answers

Check this link, http://www.w3schools.com/tags/tag_button.asp There is a note on page, which says, that different browsers can use different default type for button, if you don't specify it by yourself. Seems like your browser uses "submit".

like image 166
Dmytro Avatar answered Oct 08 '22 20:10

Dmytro