ValidationGroup issue - without group: `DoPostBackWithOptions`, with group: `__dopostback`

1.1k views Asked by At

Validation works fine until I make use of ValidationGroup. Afterward the form submits but no validation occurs. This is the href on the LinkButton before and after I use the ValidationGroup.

Before: javascript:DoPostBackWithOptions(...)

After: javascript:__doPostback(...)

The CausesValidation property is set to true. Why does adding the ValidationGroup change the postback code like that?

1

There are 1 answers

0
ValidfroM On

Once you set the validationgroup on the button, the button should only trigger the matched group validator.

ASP.Net generates WebForm_DoPostBackWithOptions is because there is a group validator on your page matching with your button's attribute ‘validationGroup’.

Your link button markup code should be similar like that:

    <input type="submit" name="btnGroup1" value="Group1" onclick="javascript:WebForm_DoPostBackWithOptions(
new WebForm_PostBackOptions('btnGroup1', '', true,'Group1','', false, false))" id="btnGroup1" />

Through debugging the js code, you should be able to find there is a js function used to find group validator. This function will validate if 'Group1' validator is there.

Debug this js method see if it can find your specified group validator.

IsValidationGroupMatch

enter image description here