0

Is there a way to avoid postbacks with gridview every time a row is added to it?

In other words, can I store the DataTable on the client and pass it on to the server control when I am done to save, rather than do postbacks every time the row is added?

I searched and searched....all I could find was web services, JSON, and I have a feeling it's redundant here...it's a simple task I am sure everyone had to do at some point.

Can anyone shed some light on this?

2
  • Please add proper tags, I'd guess that you're using ASP.net forms, if that is the case, add ASP.net as a tag. Commented Feb 3, 2009 at 20:28
  • done! will keep that in mind for the future Commented Feb 3, 2009 at 21:30

2 Answers 2

2

There is no avoiding postbacks if you're dealing with a standard ASP.NET GridView that utilizes ViewState.

You can however, disable ViewState and manually (programmatically) render the control on every page load. This will let you control every aspect of row creation/removal/updates, but you'll have to do it all manually. And yes, you'll utilize AJAX to read from or update on the server.

Sign up to request clarification or add additional context in comments.

Comments

0

I don't konw of anything that lets you do that with the gridview out of the box, except the UpdatePanel, but that doesn't really count. If you want to implement I a full AJAX grid I would look into using the ListView Control, which will give you much more control over the resulting html.

Heres a great article from MSDN Magazine http://msdn.microsoft.com/en-us/magazine/cc337898.aspx

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.