문제

i'm new to asp.net and busy with a tutorial website.

I'm trying to call a server side function using an if statement, the problem is that the if statement is completely ignored i.e the function is called regardless.

This works when using a normal js alert

code below:

$(function () {
    $("#idnum").keyup(function () {
        if (this.value.length == 13) { 
            <%= TextBox1_TextChanged(this, idnum.Text) %> ; 
            //call code behind function to get contact info with ID
        }
    });
});
도움이 되었습니까?

해결책

You can't invoke server side methods on client with your code. Try to use PageMethods in order to call server side method from client.

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