Wired Update Panel Postback Issue - asp.net

I have developed a web site and used update panel controls on all pages. The site was working fine and partial rendering was also working fine. But today update panel just stopped doing any post back. I don't know if this has anything to do with Performance Analysis, since I was experimenting with it yesterday.
I am using Asp.NET AJAX 3.5 framework, ToolkitScriptManager on all pages.
Things I tried doing.
1.) Reloaded Binary for AJAX Control Toolkit
2.) Tried to reload update panel
3.) Page methods within Update Panel seems to work. And Autocomplete Extender is working appropriately.
4.) I did backed up my code from few weeks back. It is working as expected. So I tried to copy web.config from my backup and checked it on latest code. Still not working.
Currently on any page whenever I select an item from a dropdownlist it is not doing a typical asynchronous postback and doesn't load other dependent dropdownlists.
Also update panel is not working on any of my pages. There seems to be an issue related to web.config but not sure though(I also added a new web config file but not working).
Any help in related to this would be appreciated.
Thank You.

I have solved this problem. Cause: I have written "Response.write()" in my master page. I was able to track in Chrome Console window and this was error: Uncaught Sys.WebForms.PageRequestManagerParserErrorException: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. I removed response.write and it works as it was supposed to be.

Same thing as #Mitul but it was a Response.Redirect().
It works on localhost but not in production.
I added and works everywhere !
<asp:UpdatePanel runat="server">
<Triggers>
<asp:PostBackTrigger ControlID="lnkAddProduct" />
</Triggers>
The "lnkAddProduct" is a LinkButton in a Panel.

Related

Ajax not working on Server

I have downloaded the latest toolkit from https://www.nuget.org/packages/AjaxControlToolkit/.
Problem is it works fine on my local host but not when i upload it to the server. I don't even get an error message. Simply anything Ajax related is not working. I'm suspecting that the installation I did is the problem, since it does everything automatically for me and in my project I can't add a ScriptManager since it keeps saying that I already have one in my system, eventhough I can't see in anywhere in my code.
Do anyone have any idea what the problem might be or what I'm missing?
You have a ScriptManager on the master page, and therefore when your child page gets composited with the master page there ends up being two script managers.
The normal solution is to only have the ScriptManager on the master page.

Does a Form tag for a ReportViewer needs an Action?

I'm using VS2010 to create a simple aspx page with a ReportViewer control on it. The ReportViewer control loads a remote report from the server. That seems to work fine.
But when I fill in the textfields of the report, to filter on same data then nothing is shown...
I can clearly see that it is making a request through FireBug. But the request goes through localhost, but the reports are on a different server.
Doesn't that mean i have to specify a URL or something in the form tag? Both the ReportViewer and the ScriptManager are placed in a form tag with runat="server".
So i'm not sure if i need to specify manually to what server to request has to be made for the ReportViewer to work properly.
Because all i see currently is the textfields of the report with which i can filter the data. But no report it shown, which normally appears underneath the input fields. The rest is just plain white.
Anyone any idea what i have to do?
The runat="server" is specifying if it should run on the server or the clients computer, it doesn't really have to do with the ReportViewer Control specifically, this is an ASP.NET thing.
See here: runat="Server"
In order to get Reports to be fetched from a server you should look into Remote Mode,
See here: Remote Mode
Hope this was enough to get you the results you need.

MS JS Runtime Error....Include AJAX libraries in Web.Config

Here is image of the error and the code segment where it is erroring out.
Project was originally developed in VS2010 but was "upgraded" to VS2012 cause client has that dev environment. Not sure if there are other things i need to do after the upgrade that would resolve this problem or not.
This error only occurs when i place the Me.MaintainScrollPositionOnPostBack = True in Page_Load, Page Directive, or Web.Config. I have tried using self reference and Page reference and same problem.
If i remove the line of code Me.MaintainScrollPositionOnPostBack = True from any of the 3 locations the WebDev.WebServer#### runs the application fine.
Ultimate goals is that i have an undefined length object being loaded into a table. It could be as little as 5 items in the table or up to 100. In either case each item has a RadioButtonList object associated with it. Each RBL when clicked then submits the choice selected back to the SQL server and ultimately refreshes the page. This setting was suppose to fix the problem of the refresh, or PostBack, from resetting the scroll back to the top.
Found out after removing the MaintainScrollPositionOnPostBack property but adding in AJAX controls, i received similar errors.
Question:
Any suggestion on fixing this problem, so it wont occur in VS2010 or VS2012?
Is there an alternate approach so i can sustain the scroll position on the page while still submitting the RBL selected index change event to the SQL server?
How do i fix this so the JavaScript is either installed on my computer or WebServer instance from VS2010/2012 will use Javascript?
Seems this is related to Ajax registration within the web.config even though i have it registered in the project. Anyone know what declaration i need in web.config so ajax is run from the server and doesnt require client interaction? (FYI, .Net 4)

ASP.NET Application lag after post back

When running my application lately, there is a very long delay after a request is made to the server. When debugging and stepping through, the code finishes quickly and then a dialog comes up, which I'm assuming is the reason for the lag. (I've tried a series of other options including disabling usage of ViewState, disabling debugging, installing IE 8 and reinstalling the Ajax Control Toolkit.
The dialog reads as follows:
Find Source: ExtenderControlBase.cs
Original Location: C:\Users\swalther\Projects\AspNetAjax\Releases\30930\AjaxControlToolkitSource\AjaxControlToolkit\ExtenderBase\ExtenderControlBase.cs
This is strange, since I am not familiar with any user on this machine named swalther (it was reformatted rather recently) and searching my computer for this folder turns up no results.
As usual, any help would be greatly appreciated.
That reference to swalther refers to the developer who compiled the code in the first place.
Fixed. (Second time I've answered my own question - go figure. I'm creating a database of my bugs :) )
Changed this line:
<asp:ScriptManager ID="scriptManager1" runat="server" EnablePageMethods="true" />
to this:
<ajaxControlToolkit:ToolkitScriptManager ID="scriptManager1" runat="server" />
Looks like you have to use the ajax control toolkit script manager instead of the ASP version.

ASP.NET broken rendering of Validation client side code in Firefox

This one has been a stumper for me. Its very easy to duplicate though a rather obscure issue. It came about as I was doing some javascript work on a web page yet also make use of the validation controls that ASP.NET provides.
Some specifics up front: using a Vista-based development machine with the 3.5 framework and IIS 7. I also have a QA machine that is running windows server 2003, also with the 3.5 framework but running IIS 6.
Take a page with a simple TextBox, Validation Control, and button to submit them. For example:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Text is Required" ControlToValidate="TextBox1"></asp:RequiredFieldValidator>
<asp:Button ID="btnSubmit" runat="server" Text="Submit" />
Simple ASP.NET validation control code here ... The idea here is that client-side validation code is generated for the required field and a postback is not done unless the text box has a field. If the browser does not support client-side scripting, then ASP.NET will catch it on the server side using the Page.IsValid property.
When I run this from my Vista-based development machine, the client-side scripting code is generated for both IE and Firefox and works just fine.
When I run from the win2003-based QA machine, client side code for the validator controls is also generated for both browsers. The validation code for IE works fine ... but does Not work for Firefox. When the submit button is pressed (with an empty text box), the client-side code appears to be ignored and a postback performed. Now the validation error is caught server side - but I want to know why its not working client side in the first place.
The interesting quirk here is that if I take page source views under Firefox from the Development machine (the one that works) and the QA machine (the one that doesn't) and compare them - the client side validation code is dramatically different.
Ideas on what to change to get the client side validation code to work in Firefox with the QA machine?
UPDATE: Had a few comments asking to see the generated source. I've saved the Dev and QA source as .htm files and zipped them up. You can get them at http://www.optsolutions.com/testvalidation.zip
Check your web.config for xhtmlconformance and make sure it is not set to legacy.
http://aspadvice.com/blogs/rbirkby/archive/2006/11/01/Client_2D00_side-validation-in-Firefox.aspx
I am having the same issue with a similar setup. Differences in the browserCaps settings is the most promising possibility I have come across so far.
http://msdn.microsoft.com/en-us/library/sk9az15a(VS.80).aspx

Resources