4

I'm trying to get an html button to call a server-side method like this:

<button onserverclick="onClick" runat="server">Submit</button>

However, this call is not being made when the browser's javascript is disabled.

I am confused because my understanding is that this call has no interaction with javascript.

1 Answers1

3

The __doPostBack() method is responsible for raising a click event to the server in the background. With JavaScript disabled there's no way that's going to happen.

Here's one of the many articles that explains how this works. And a related question here which gives a glimpse into what code is generated behind the scenes.

Community
  • 1
  • 1
Robin Maben
  • 22,194
  • 16
  • 64
  • 99
  • I see, thanks! How then would I go about submitting a form to the server without JavaScript? – blackconstant Aug 28 '12 at 20:03
  • @blackconstant: Use the plain `action` attribute on the form. Also, You could also use the [noscript](http://www.w3schools.com/tags/tag_noscript.asp) HTML tag. Maybe to display a message to the user, at least? – Robin Maben Aug 28 '12 at 20:06