Reputation: 31
I am using a asp:textbox
and it is firing ontextchanged event, and in that event I am binding the value to a session variable. My problem is that it postsback the page everytime, so I want to avoid the postback in that event.
Please assist me in doing the same.
Upvotes: 3
Views: 98
Reputation: 879
If you want to handle the event on the Client-Side (JavaScript) then you should use onchange
.
Now it is handled on the Server-Side because of OnTextChange is part of the asp:TextBox
and is a server side event. Basicly Server-Side events = postback
Upvotes: 0
Reputation: 34905
OnTextChanged
is a server event and if you want it fired and your session state updated correctly then the page needs to undergo a postback. Another approach is to use onchange
which is a client event and to update your session state via javascript
performing an ajax call to your back-end.
Upvotes: 1