Page doesn't postback if it has validation control after deployment
I have a page with a RadioButtonList which should post back when the selection is changed. But because of RequiredFieldValidator on the page, the postback is not happening. It is working fine on //localhost/ but not after deployment to production server.
The error on the page is: 'event' is null or not an object
Line: 126 Char: 5 Code: 0URI: http://web-dev:90/aspnet_client/system_web/2_0_50727/WebUIValidation.js
A few things which I have already tried:
1) aspnet_client folder is in its proper 开发者_Python百科place.
2) I have added Page.Validate() and if(Page.IsValid){}
statements with the button on whose click the validation should happen.
3) The ValidatorCommonOnSubmit function in WebUIValidation.js
file looks like this:
function ValidatorCommonOnSubmit() {
event.returnValue = !Page_BlockSubmit;
Page_BlockSubmit = false;
return event.returnValue;}
Can somebody help me with this? Any help would be appreciated. Thanks!!you can group the required field validator related controls so that it wont effect the radio button list.
<asp:RequiredFieldValidator ID="rfv" runat="server" ValidationGroup="button1"
ErrorMessage="*"></asp:RequiredFieldValidator>
<asp:Button ID="Button1" runat="server" Text="Button1" ValidationGroup="button1" />
As far as your radio button list is not grouped under "button1" group, it will not have any problem.
Details here and here
精彩评论