Junior Developer
Junior Developer

Reputation: 161

Why does my button output WebForm_DoPostBackWithOptions?

I need my page to work when JavaScript has been disabled. But my button is outputting onclick="WebForm_DoPostBackWithOptions...". When I set CauseValidation="false" it disappears but I need validation. In what circumstances is WebForm_DoPostBackWithOptions outputted? And how can I get around this problem?

Upvotes: 5

Views: 7095

Answers (2)

Mick
Mick

Reputation: 6864

Not including the ValidationGroup attribute can cause the same issue.

<asp:RequiredFieldValidator ValidationGroup="Save" />

Or the control to validate is incorrect

Upvotes: 1

Leon
Leon

Reputation: 3401

Validation controls use both Client and Server validation. On the client, javascript is used for validation, and is required.

You can force validation controls to not use client script, which might help you with this issue.

<asp:RequiredFieldValidator EnableClientScript="false" />

Upvotes: 2

Related Questions