Quote:
the grid contains 10 rows.
I am smelling that this code belongs to ASP.NET Web Forms, if so then you need to make sure that each time the page is sent to the server, you are storing the state of the controls and returning the state to the browser—which will be shown to the user after the page reload. Check out the following links to understand how this would work,
asp.net webforms and jquery: How to save/restore jquery state between postbacks? - Stack Overflow[
^]
viewstate - How to store ASP.NET WebForms page state between requests - Stack Overflow[
^]
One of the
simple, clean and elegant ways to do that is using
event.preventDefault();
that will prevent the form being submitted. But in this case, you need to upload the content yourself to the server using Ajax etc.
$("#btnId").click(function () {
event.preventDefault();
});
Since your framework is ASP.NET Web Forms, you need to make sure that this JavaScript is called from the client side, like this,
OnClientClick="uploadDataManually(); return false;" />
You can also use the control id that you set in ASP.NET Web Forms in the JavaScript code to control this behavior, that is up to you.