Pregunta

This is my code:

<asp:LinkButton 
OnClientClick="Page_ClientValidate(); if(Page_IsValid==false) { console.log('validate'); return false; }" 
ID="LinkButton1" 
ValidationGroup="validPanel1" 
runat="server">Check</asp:LinkButton>

but when I click on it, it try to validate the whole Page. I just need to validate the validPanel1's Page. Is it possible?

¿Fue útil?

Solución

you can do this by simply provide the validation group name to Page_ClientValidate

<asp:LinkButton OnClientClick="Page_ClientValidate('Your_ValidationGroup_Name'); if(Page_IsValid==false) { console.log('validate'); return false; }" 
ID="LinkButton1" ValidationGroup="validPanel1" runat="server">Check</asp:LinkButton>

kindly check this question. It's about another problem but he first do what you want to do.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top