Showing posts with label updatepanel. Show all posts
Showing posts with label updatepanel. Show all posts

Wednesday, March 28, 2012

ViewState

Hi,

Is there any way to turn off ViewState (for real) using the ScriptManager and UpdatePanel? I have EnableViewState on both set to false, but Im still seeing responses of about 100k.

Thanks

Joe

set the enableviewstate=false.

then use ctl+F5 for clear the cached output


Tried that, but it didnt make a difference (unless you are talking about at the page level, in which case I cant without fairly significant changes to things unrelated to what Im working on)

Thanks,
Joe


The EnableViewState property of the ScriptManager only refers to the ViewState of the particular ScriptManager control itself.

Due to the underlying way that UpdatePanels work, the full page's ViewState must be sent to the server. The full page life cycle is still executed in a partial postback, so the ViewState is necessary to re-instantiate the state of the page and it's controls.

However, you canuse page methods to avoid the data-heavy partial postbacks in many cases. The best solution really depends on what exactly you're trying to do, but there's unfortunately no way to remove the ViewState from partial postbacks.

ViewState in Session is still uploaded after AsyncPostBack

Hi all,

Here is the basic setup of my page.

- ViewState stored in session
- AutoCompleteExtender using a WebService
- UpdatePanel triggered by button next to AutoComplete TextBox

Here is the behavior I'm experiencing (note that I have validated this with Fiddler):

Page loads first time. "id="__VIEWSTATE" value="y0V/cubnEZ1qzAvIgW0oRpVSc8AvJU6rtssTVFt7+B8="
ViewState is short as expected because storing it in the session.

Now, I click on the button to activate the UpdatePanel, causing a partial postback. This takes much longer than expected. After inspecting with Fiddler I see that it is uploading 50K. I inspect the Request and notice that most of it is my ViewState (I have a repeater on the page). I even turned EnableViewState off on the Repeater and it still uploads it.

My questions are:

1. Where is this uploaded ViewState coming from? It was not downloaded, is it generated clientside by JavaScript?
2. How can I stop this ViewState from being uploaded?

Regards,
Cole

I now realize this is not the viewstate but all of the form elements names & values being concatenated together. Is there a way to adjust what gets sent back from the controls on a AsyncPostBack?


The only way I'm aware of is to not use updatepanels to traffic your info, but instead to use web services, page methods, or hand-jam your own webrequest.

Monday, March 26, 2012

Visual Studio "Loses" controls inside an UpdatePanel

Hi,

I'm using a couple of UpdatePanels on a page and it seems that Visual Studio periodically loses track of controls that are inside an UpdatePanel, throwing errors that say those controls don't exist. If I restart Visual Studio the problem goes away.

Any ideas?

Thanks!

Anybody?


I am having the same problem here.. no solution yet.
I'm also having this problem, the difference is that re-loading VS doesn't get rid of it.

Saturday, March 24, 2012

Wanting to programmatically turn UpdatePanel on and off

I'd like to have a checkbox on my page thet lets me turn the atlas feature on and off. (just as if I had removed the <atlas:UpdatePanel> tags from my web page. Is there some way to do that?

Hi Peter,

I believe you should be able to just turn the partialpagerendering property to false on the scriptmanager control. This will then disable partial page updates.

Hope this helps,

Scott

Wednesday, March 21, 2012

Web App Projects and ScriptManager/UpdatePanel

I am VERY new to this so please excuse me for this obvious question. I have started a basic web app project in VS2005. Just a button, label and textbox. Wors fine. If I drop a scriptmanager and update panel on the page and move the three controls to the update panel I get a scripting error that 'Sys' is not defined. The error is in the page source script shown below:

Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tUpdatePanel1'], [], [], 90);

Is there a way to prevent this or edit the script that the script manager produces so as to not throw the error?

Thanks

Hi ixis,

You will have to use the "ASP.NET-Enabled Web Site" template instead of the "Empty Web Site" when creating a new Ajax application so that http handlers and modules are registered in your web.config. Here's an example of an Ajax-Enabled Web Site's web.config:


<configuration> <configSections> <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false"/> <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" /> <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" /> <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" /> </sectionGroup> </sectionGroup> </sectionGroup> </configSections> <system.web> <pages> <controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </controls> <tagMapping> <add tagType="System.Web.UI.WebControls.CompareValidator" mappedTagType="System.Web.UI.Compatibility.CompareValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add tagType="System.Web.UI.WebControls.CustomValidator" mappedTagType="System.Web.UI.Compatibility.CustomValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add tagType="System.Web.UI.WebControls.RangeValidator" mappedTagType="System.Web.UI.Compatibility.RangeValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add tagType="System.Web.UI.WebControls.RegularExpressionValidator" mappedTagType="System.Web.UI.Compatibility.RegularExpressionValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add tagType="System.Web.UI.WebControls.RequiredFieldValidator" mappedTagType="System.Web.UI.Compatibility.RequiredFieldValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add tagType="System.Web.UI.WebControls.ValidationSummary" mappedTagType="System.Web.UI.Compatibility.ValidationSummary, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </tagMapping> </pages><!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. --> <compilation debug="false"> <assemblies> <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </assemblies> </compilation> <httpHandlers> <remove verb="*" path="*.asmx"/> <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/> </httpHandlers> <httpModules> <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </httpModules> </system.web> <system.web.extensions> <scripting> <webServices><!-- Uncomment this line to customize maxJsonLength and add a custom converter --> <!-- <jsonSerialization maxJsonLength="500"> <converters> <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/> </converters> </jsonSerialization> --> <!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. --> <!-- <authenticationService enabled="true" requireSSL = "true|false"/> --> <!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and writeAccessProperties attributes. --> <!-- <profileService enabled="true" readAccessProperties="propertyname1,propertyname2" writeAccessProperties="propertyname1,propertyname2" /> --> </webServices><!-- <scriptResourceHandler enableCompression="true" enableCaching="true" /> --> </scripting> </system.web.extensions> <system.webServer> <validation validateIntegratedModeConfiguration="false"/> <modules> <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </modules> <handlers> <remove name="WebServiceHandlerFactory-ISAPI-2.0"/> <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="ScriptResource" verb="GET" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </handlers> </system.webServer></configuration>

Thanks, I'll give that a try. Just to note because I wasn't very clear in my original post, if I create a normal ASP.NET Website project, the UpdatePanel works just fine. If I create a Web Application Project using the Visual Studio 2005 Web Application Project Model I have the problem. I'm not saying your solution isn't what I am looking for just clearing up the original question. I am certainly going to review my web.config as per your post.

Web Part Verb Menus inside UpdatePanel...

I have 6 webparts inside UpdatePanels on my masterpage. The contents of all of the webparts are usercontrol.ascx's.

One of which is only moveable, the others are moveable, closeable, and minimizeable. There are 3 on the left side, and 3 on the right side. All 6 webzone's contents are dragable etc, and work perfectly. My problem is that the three webzones on the right work fine with regards to close, minimize/restore. As for the 2 on the left, only one will work, then the verb menu for the other one won't work anymore untill a new page load. If you choose WebZone2 to close/minimize, then WebZone3's verb menu will fail to load. The small triangle is there, but no menu drops when it is clicked on. If you choose WebZone3 to minimize, then WebZone2 won't work properly.

All the webzones look like...

Not sure why, the zones on the right don't work properly.

<

atlas:UpdatePanelID="wbpz6"runat="server"><ContentTemplate><asp:WebPartZoneID="WBPZNews"runat="server"BorderColor="#CCCCCC"Font-Names="Verdana"Padding="6"Width="120px"><PartChromeStyleBackColor="#F7F6F3"BorderColor="#E2DED6"Font-Names="Verdana"ForeColor="White"/><MenuLabelHoverStyleForeColor="#E2DED6"/><EmptyZoneTextStyleFont-Size="0.8em"/><MenuLabelStyleForeColor="White"/><MenuVerbHoverStyleBackColor="#F7F6F3"BorderColor="#CCCCCC"BorderStyle="Solid"BorderWidth="1px"ForeColor="#333333"/><HeaderStyleFont-Size="0.7em"ForeColor="#CCCCCC"HorizontalAlign="Center"/><MenuVerbStyleBorderColor="#232323"BorderStyle="Solid"BorderWidth="1px"ForeColor="White"/><PartStyleFont-Size="0.8em"ForeColor="#333333"/><TitleBarVerbStyleFont-Size="0.6em"Font-Underline="False"ForeColor="White"/><MenuPopupStyleBackColor="#232323"BorderColor="#CCCCCC"BorderWidth="1px"Font-Names="Verdana"Font-Size="0.6em"/><PartTitleStyleBackColor="#232323"Font-Bold="True"Font-Size="0.8em"ForeColor="White"/><ConnectVerbVisible="False"/><ExportVerbVisible="False"/><HelpVerbVisible="False"/><EditVerbVisible="False"/><ZoneTemplate><uc5:AFCSNewsID="News1"runat="server"></uc5:News></ZoneTemplate></asp:WebPartZone></ContentTemplate></atlas:UpdatePanel>

Thanks,

Ted

I just posted with a similar problem. Did you ever resolve this?

Nope, some of my webparts have this problem, and some of them don't. Never have figured this out.

Texx


Thanks. I'm hoping that now, since we can dynamically add update panels (as of the June CTP) that maybe it might avoid the problem. But we haven't gone down that road yet...

Web Parts and AJAX

OK - so I understand the official line is that ASP.Net Ajax UpdatePanel does not work properly with Web Parts. However I am a little puzzled becuase I did a test and got something working fine:

I built two CONNECTED web parts - one is a simple filename provider (a textbox and an Update button) the other web part displays a flash file based on the filename specified by the first web part. I put them both inside a web part zone, and then enclosed the WHOLE web part zone inside an Ajax Update Panel. Now, when I enter a new filename inside the first web part and click its update button - the second web part loads and plays the new flash filename WITHOUT any flicker - ie it seems to work fine.

Has anyone else tried this? Have I missed something?

I realise that my test is somewhat limited in that I can't connect web parts in different web zones but even so the above technique still seems useful if its safe to use.

Comments anyone?

The way I see it the whole point of Web Parts is that you can define several areas on a page to contain them and then move them around between the areas, reorder them, change their settings, add new ones etc. This doesn't work with ASP.NET Ajax.

For what you've described above I don't see the point in using Web Parts at all, why not just a couple of controls inside an UpdatePanel?

Personally this lack of support (and no mention of when support might be re-introduced) has forced us to create a home-grown solution.


I understand what you are saying - nevertheless keeping the web parts within one zone would still allow you to reorder them within that zone, change their settings, and still allow you to connect web parts together (again within that one zone) - and those web parts could still refresh without the rest of the screen flickering because the whole zone is sitting in a single UpdatePanel. In fact for my requirements I have simulated a tab panel type display whereby each web part in that zone sits in a seperate <DIV> tag which I can hide or display at will - therefore being able to arrange web parts or drag them around is not a requirement for me.

Regardless of how useful you may/may not think it is - I just want to know whether it is "safe" to place a whole Web part Zone containing several web parts inside an UpdatePanel - as it seems to work a treat. I still get the benefit of connectable web parts with the benefits of Ajax too.


(Bumping)

Has anyone else successfully placed a web part inside an UpdatePanel and got it to work? Supposedly it used to work in an earlier CTP of Ajax but then doesn't work in the final release of Ajax? I'm just puzzled as to why it seems to work fine for me?


Despite my short rant above I have tried it and got it to work, I only really came accross problems when loading the WebPartEditor and catalogue. I guess your right if all you need is the reordering etc. then maybe thats OK. If it works I'd go for it, only drawback I can see is it might completely break in a future release.

Web Parts menu/dragging disabled after partial update

I have a:

UpdatePanel. Inside it is a WebPartZone. Inside it is a web part.

It really simple. Button click and change the textbox to something. My problem is that as soon as I execute this the web part "verb" menu goes away and you can't drag and drop the web part after the first time it does the partial update. When you first load the page menu/dragging and dropping works fine.

Is this is a bug?

I have the same problem with asp.net ajax RC!!!!

It seems there is a big bug!!!!

It seems there is no tester in the asp.net ajax development team!!!Confused


To get around that problem can you on the postback set the webpartzone to enable again?