Hi, i've prepared a form using Rad controls and i need to use 3 controls to Upload files. I had some first problem to validate these controls, solved using hidden fields that I value when a file is uploaded.
So when I press the Submit button (RadButton) the page is actually validated, but if there are problems on some other fields than RadAsyncUpload, the result is that the upload control loses the correct information on display.
I'm using Ajax, Telerik UI R2 2019, the jquery version i see is v1.12.4, Page_ValidationVer = "125";
I've read many discussions, but there's something wrong in my case.
I tried to intercept the validation in order to maybe implement something like this
https://www.telerik.com/forums/retain-uploaded-files-for-display-after-postback
but I can't, because if I try to call the function Page_ClientValidate it always returns TRUE.
function
Page_ClientValidate(validationGroup) {
Page_InvalidControlToBeFocused =
null
;
if
(
typeof
(Page_Validators) ==
"undefined"
) {
return
true
;
}
var
i;
for
(i = 0; i < Page_Validators.length; i++) {
ValidatorValidate(Page_Validators[i], validationGroup,
null
);
}
ValidatorUpdateIsValid();
ValidationSummaryOnSubmit(validationGroup);
Page_BlockSubmit = !Page_IsValid;
return
Page_IsValid;
}
Trying in debug i see that Page_Validators = undefined so the function exit with 'true'
The form submit correctly and server-side i see Page.IsValid property values but I need to perform the submit only where all fields are compiled or the asyncupload controls mantains their state after validation.
Could there be confusion between client and server validation?
Do you have any ideas? Thanks
8 Answers, 1 is accepted
Update: if i insert this line in web.config
<
add
key
=
"ValidationSettings:UnobtrusiveValidationMode"
value
=
"None"
/>
validations seems to be performed on the clientside, (and the problems about upload controls is solved) except the radiobuttonlists, them are validated server-side generating the problem again
<
telerik:RadRadioButtonList
ID
=
"rblSex"
runat
=
"server"
AutoPostBack
=
"False"
>
<
Items
>
<
telerik:ButtonListItem
Text
=
"M"
Value
=
"M"
/>
<
telerik:ButtonListItem
Text
=
"F"
Value
=
"F"
/>
</
Items
>
</
telerik:RadRadioButtonList
>
<
asp:RequiredFieldValidator
ID
=
"rfv_sex"
runat
=
"server"
ErrorMessage
=
"*"
ControlToValidate
=
"rblSex"
Display
=
"Dynamic"
ValidationGroup
=
"std"
></
asp:RequiredFieldValidator
>
This article talks about jQuery troubleshooting, but i'm not sure of my environment...
https://docs.telerik.com/devtools/aspnet-ajax/general-information/troubleshooting/jquery-troubleshooting#how-to-use-unobtrusive-validation-in-net-45-telerik-web-site--telerik-web-application
i think I've created a Telerik Web Application but how can I verify this?
Also my RadScriptManager is void, only declared in the MasterPage.Master
<
telerik:RadScriptManager
runat
=
"server"
ID
=
"rsmUno"
></
telerik:RadScriptManager
>
The validation on the client for the RadioButtonList without a postback can be achieved only with CustomValidators: https://docs.telerik.com/devtools/aspnet-ajax/controls/radiobuttonlist/functionality/aspnet-validators-support#validation-on-the-client.
The <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" /> key is needed for client-validation for projects with .NET framework version 4.5 and higher: http://stackoverflow.com/questions/16660900/webforms-unobtrusivevalidationmode-requires-a-scriptresourcemapping-for-jquery.
Here you can find information about the difference between the WebSite and WebApplication: https://stackoverflow.com/questions/398037/asp-net-web-site-or-asp-net-web-application. An easy way is to check the project icon as it is different for the web site and application.
Another thing is that the Web Application has CodeBehind property and aspx.designer.cs file for the web form while the Web site has CodeFile property and no designer files.
Regarding the persistence of the uploaded file across postbacks, you can check the following articles:
- https://docs.telerik.com/devtools/aspnet-ajax/controls/asyncupload/how-to/how-to-persist-uploaded-files;
- https://www.telerik.com/support/kb/aspnet-ajax/upload-(async)/details/dynamically-change-the-postbacktriggers-collection-of-the-asyncupload;
Regards,
Peter Milchev
Progress Telerik
Hi,
because my project make a single .dll and files has .aspx.designer.cs i understand that i'm using a web application.
Yesterday i've replaced the required validators with custom validators for radio button controls, and the client-side validation has worked.
this shuffled the cards and the problem about the persistence of the async upload state disappeared :-)
So right now the page is working properly.
Also my void RadScriptManager is this correct?
It is good to hear that everything is working now.
Regarding the RadScriptManager, the declaration as it is now is entirely functioning because all the necessary properties have already defined default values.
Regards,
Peter Milchev
Progress Telerik
Regards,
Peter Milchev
Progress Telerik
Sorry Still not understand,
Can give more simple demo?
Thank you.