I have recently developed a pretty comprehensive Inventory application for my company. Today I loaded up SQL Server Profiler for the first time and started to play around in the application to see what and how many queries are really being ran. One section of my application utilizes a gridview that selects from 5 different tables to pull its information in. I notced that on every postback (paging, sorting, etc) there are my Union queryies ran again. Login, Query, Logout 5 times! This is okay for now and I am on good hardware and a gigabit link between my IIS and SQL...BUT..in terms of scalability and long term preformance I don't think this is the most Ideal solution...especially to grab the same data OVER AND OVER again. Is there a way to utilize the cache so a SQL query only gets executed once every session and then pulls from the cache or something similar? Is this already the 'best' option? Maybe I am underestimating SQL but if there are a few thousand products getting queiried 5x by a handfull of people...my application is going to slow WAY down.

Also I used a new design method that worked really well for me...I don't know that it is recomended though. I included about a dozen user controls (panels with different forms and gridviews/details views) in my default.aspx. From there I control the whole application in one AJAX Update panel and use a hideall funciton that enabled=false and visible=false to every panel..then enable the panel that I want to work with dependant on what button or funciton is being pressed/preformed. ALOT of my panels include sqldatasources and I noticed some of them are running select commands on every postback as well...this is not 'optimal' in my eyes. Any ideas to rectify these issues WITHOUT redesigning my whole application?

Any and all tips/hints/solutions are much appreciated!

Recommended Answers

All 3 Replies

One thing you might want to look into is the IsPostBack property of Page.

You can use the Page.IsPostBack property to control various elements of your page to only run on postback or only run if it's not a postback and so forth.

Hope that helps :)

I do utilize this quite a bit but when you wrap several hidden panels into an update panel for AJAX it makes a postback on just about EVERYTHING so its hard to use this byitself to do checking in my application. As I type this though I realized I can pair this with a IF pnlXXX.enabled= true AND page.ispostback = true then ...hmmm. :)

Now to find out if there is a
gridview.DONT_SELECT_ANYTHING_ELSE

Now to find out if there is a
gridview.DONT_SELECT_ANYTHING_ELSE

Sorry, bit off topic but this made me chuckle :twisted:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.