Frage

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?

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top