문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top