Showing posts with label database. Show all posts
Showing posts with label database. Show all posts

Wednesday, March 28, 2012

Why slow UI with AJAX?

I am working on a page that displays paged ResultSet from a database. I created the page without AJAX update panels. Later I added those to ajaxify my application. The problem is when I change pages in my GridView the time it takes for it show the new results (using Asynchronous postback) is about 4 secs more then a regular postback.

Does any one know why it is slow. I usedfiddler tool to check the response size and Asynchronous postback does come back with less number of bytes but why slow UI update?

Thanks for your help.

The thing that will effect your AJAX postback the greatest is the size of your ViewState.

Comment out your update panels & script manager and then enable tracing for your page.<% @.Page Trace="True" %>The trace information will show you exactly how large your ViewState is for that page. Try paging through your GridView and see if you ViewState size grows as you page. Even if the size doesn't grow, if the initial ViewState size for your page is very large, it will cause long delays between AJAX postbacks. If you do find that your ViewState is huge, or it grows between postbacks, try to figure out which controls you can disable the ViewState for (EnableViewState="False") or what might be causing your ViewState bloat.

Just as an FYI, I have used UpdatePanels with GridViews in many different cases without a problem. I did have to tune the ViewState for some of the pages I made to speed things up, but it can definitely be done and it works great.

-Aaron


I am totally agree withSchnieds , that you have to disable the viewstate wherever it is not necessary..

Do one more thig also..try to set <compilation debug = "false" > in web.config

Hope it will help you.Smile


Thanks for your replies. I tried to turn the viewstate off for the gridview but then my pagging gets all screwed up. I have a dynamic paging option where user can select the number of results displayed per page. When I turn off the viewState it gets set to the default value (which is 14) and the page index gets set to 1.

Any ideas?

P.S.: I do have the <compilation debug="false" />


You probably won't be able to disable the ViewState for your GridView, but you may be able to disable it for other controls on your page and decrease the overall ViewState size.

Turn on tracing as I suggested, figure out what control(s) have a large ViewState and look for the other things I mentioned in my previous post. You should be able to determine what is causing your ViewState bloat very easily with the tracing turned on.

-Aaron

Wiki Januari/Februari CTP question

Downloaded the latest bits of the Wiki but was unable to attach the needed database files to my SQL Server 2005.I can't run SQL Express beside SQL Server for some stupid reason so I'm missing the .ldf files in order to be able to get the project going.

Can these .ldf files be retrieved somehow or is there some other procedure that I can use to get the .mdf files attached?

Or even better can someone explain me why I can see SQL Express in the SQL Server Managament Studio and play with it but when I want to view the databases in my App_Data subfolder in VS.NET 2005 I'm unable to get access to it... Error message always gives me this:

Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.

Also when I just want to run an application by hitting F5 I get this message.

Thanks in advance!Anyone?

Hi,

I already provided an answer toyour post that pointed to this one. You can use the

sp_attach_single_file_db command to get it to work.

Grz, Kris.

Wednesday, March 21, 2012

Write to database using AJAX

Hello, everyone. I'm trying to finish up a project where users store information into our sales database. It would be immensely helpful to be able to insert this data (or update the data) without refreshing the page, which I can only imagine would use AJAX. Unfortunately, I'm having a hard time finding the proper information on how to do this. Is there a handy little AJAX control that helps with this? Is it something I'll have to write myself? Any hints, suggestions and/or pointings in the right direction would be greatly appreciated.

not sure on what you have, but you do have several options:

1. use web services to do that. you'd call them through your page by using js proxies that can be automatically inserted on the page.

2. use an updatepanel to wrap parts of the page that should be refreshed.


Luis Abreu:

1. use web services to do that. you'd call them through your page by using js proxies that can be automatically inserted on the page.

This is precisely what I'm going to try to use. Seems cleaner to me and I think I understand it better than the updatepanel. Thanks for the information! I really appreciate it.


hello again.

yes, if you ask me, the correct way of using ajax it to use web services to get the data and then js to update the dom presented by the browser. anyway, you cannot deny that the UpdatePanel has some cool things and it'll work nicely in several scenarios.