Hi i have a web app and most of the pages work fine, but i have two that are responding very slowly. I use Atlas update panels on the page so i thought if anything the responce would be quicker.
The postback is not doing a great deal. all i am doing is selecting a link button on a grid view which has the command='select' property. Within the row_command event all i am doing is changing the state of a couple of buttons on a seperate update panel.
The buttons act equally slow, they perform more code but still not a 4/10 sec round trip as i have other buttons that do more yet postback faster.
Any thoughts appreciated.
Steve
Hi Steve,
Can you check two things:
1) Are you running the app in debug mode? If so, the Atlas script libraries get downloaded on each request -- and that might be one cause of the delay.
2) What is the size of the viewstate on the page that you are working on? It could be that you have a lot of viewstate on the page which is slowing it down. Disabling viewstate would make postbacks work much faster.
Hope this helps,
Scott
Hi Scott
Thanks for posting.
I dont have it in debug mode.
How would i find the size of viewstate?
Steve
Scott
I disabled view state and the datagrid came back empty. The grid is only 1 col which is a template field with a link button in.
Steve
I have just done a view source on the two pages in question.
One: Viewstate = just short of 45000 chars.
Two: Viewstate = just short of 9000 chars.
So i guess thats the problem?? I am guessing that to cure the gridview coming back blank i will need to rebind on each postback?
Steve
How do i use properties like selectedindex from the gridview when viewstate is disabled??
You can use ControlState instead, which acts a lot like ViewState except that it's never turned off. Seehttp://msdn2.microsoft.com/en-us/library/system.web.ui.pagestatepersister.controlstate.aspx for more information. I'm not 100% sure you can enable at the page level as its supposed to work on controls, but then again a page is just a control
HTH
Thanks
How do i use the selectedindex from control state?
Steve
i use selectedvalue all over the place. Without creating my own control from the gridview is there anyway i can use this value.
I guess the selectedindex would work i could put the id in a hidden value and get it that way BUT... with view state turned off on the gridview i am unable to get the selectedindex, i thought selectedindex was held in control state....is there something special i need to do to use the control state properties?
Thanks
Steve
OK got it sorted.
on rowdatabound i have done e.Row.EnableViewState=false;
this has reduced the viewstate from 50K chars to a little over 6K. And I can access selectedvalue OK.
Time to stick it up live and see how we go.
Thanks, Steve
No comments:
Post a Comment