Showing posts with label server. Show all posts
Showing posts with label server. Show all posts

Wednesday, March 28, 2012

AJAX UpdatePanel works on dev machine but still flickers on web server.

Hi Guys,

I have a master page, that has a ScriptManager and some "RoundCorner" controls. I also have a child page with a textbox and a FormView.

So I created an UpdatePanel, put my FormView inside the ContentTemplate, created the trigger and assigned to the TextBox's TextChanged event. (to an Async trigger).

When I run the app on the dev machine, it works wonders, no flickering and only the formview gets "refreshed". But as soon as I upload the code to the WebServer, the entire page gets refreshed everytime I change the value on the TextBox.

Am I forgetting to have something setup on the server side? I didn't find a "Deployment guide" for AJAX (If theres one, please point me to the right direction), so I figured that installing the MS Ajax 1.0 on the server would do it.

Thanks!

Marcelo

More info:

Just tried a small example, and again it does not work on the server side (both dates get updated):

<%@. Page Language="C#" AutoEventWireup="true" CodeFile="TestPage.aspx.cs" Inherits="TestPage" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server">From here, it is inside the panel <br /> <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"> </asp:ScriptManager> <asp:UpdatePanel runat="server" ID="UpdatePanel1"> <ContentTemplate> <asp:Label ID="TestLabel" runat="server" Text=""></asp:Label> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" /> </Triggers> </asp:UpdatePanel><hr/>From here down its not inside the Panel<br /> <asp:Label id="Test2Label" runat="server" text="" /> <asp:Button ID="Button1" runat="server" Text="ClickHere" /> </form></body></html>

***********CS content

using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;public partialclass TestPage : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e) {TestLabel.Text = DateTime.Now.ToString();Test2Label.Text = DateTime.Now.ToString(); }}

Anyone has ideas?

Thanks!

Marcelo


Nobody at all?


Hello,

Take a look at my post and the solution we found:http://forums.asp.net/thread/1649057.aspx

Possibly your case is similar.


Hi there,

At first it seemed that I had my problem solved, since the properties show exactly the same as yours.. So I tried to change the property to true, but no luck, it still does a full refresh on the

server side..

I checked your sample site, and I it does a full refresh aswell.. what part of if should do a partial refresh?

Could you send me the code you have on your page Init?

this is what I've added on mine:

private void Page_Init(System.Object sender, System.EventArgs e) { ScriptManager1.SupportsPartialRendering =true; }

I'm getting frustrated with this...


Hi,

The partial refresh on our page (http://beta.easyquerydemo.com) works only for "Result" panel (at the bottom of the page). If you define some query using "Conditions" panel (for example: "Customer Company Name starts with A") and then click on "Update Result" button the result set should appear almost immediately and without updating the whole page.

As for code: we use exactly the same line of code as you published in your previous post.

Did you check the value of this property after assignment. Maybe it still is set to 'false' because of some limitations in browser which you use to access this page.


In this example of yours, both Labels get updated because you update the datetime in your Page_Load function.

Your Page_Load function should be like this:

Protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
TestLabel.Text = DateTime.Now.ToString();
Test2Label.Text = DateTime.Now.ToString();
}
}

And your button to update the Label inside the updatepanel should call a function to update the datetime of that label.

Protected void UpdateLabel(object sender, eventargs e)
{
TestLabel.Text = DateTime.Now.ToString();
}


Hi,

What i'm doing is the following, on page_init i force the property to be true, and on page load i load all those variables into labels, just like you do on your sample site. It does in fact change that property to True. but the full refrensh still occurs.

Now I see the part that uses the update panel (The result on your site). And it actually works.

Do you have any other hint?

Correct me if I'm wrong but, theSupportsPartialRendering property is set based on:EcmaScriptVersion,SupportsCallback andW3CDomVersion; which are properties of HttpBrowserCapabilities that is assigned from a Request.Browser object.

That means that it is checking the Client's Browser capabilities, and nothing to do with the server itself right? If thats true, as long I use the same browser (IE7 for instance) it should not matter where that page is sitting at, it should bring the same value for SupportsPartialRendering...

Is my line of thought correct or I am missing something ?

Thanks a lot for the help you are giving me!


Hi there,

1. About "other hint". No I do not have it unfortunately. The only one thing I can suggest is to try add another UpdatePanel on your page and some simple controls into it (e.g. one button and one label) just for testing and see how it works. Another good idea will be to create another simple testing page using AJAX template in Visual Studio (if you use it) and see how it works on your server.

2. About the properties whichSupportsPartialRendering is based on: yes you are right, at least we understand this part of documentation exactly the same way.

Possibly we should send this request to Microsoft? There must be more conditions for partial rendering support except those ones described in documentation. I think there must be some requirements for server side.



Hey,

I will create a brand new example using the AJAX project template and report back my findings.

I agree, but I never done this before. Usually I can find a work-around for these type of issues, which doesn't seem to be the case right now. How should I proceed on submiting this to MS?

Regards


Hi again there,

More findings:

1. I created a brand new application and used the same sample as before, but this time I added the labels and forced SupportPartialRendering to true.

Amazingly the application worked just fine on the server side.

2. I've added a master page to this application and wired up the old "default.aspx" to the master page, moving the ScriptManager to the master page (and also the SupportPartialRendering portion)

Application stopped working.

3. I moved the ScriptManager (and SupportPartialRendering) back to the Default.aspx and removed from the master page.

Application still didn't work.

At this point I think is safe to conclude that: UpdatePanels will not work with master pages!!!?

PS: All the 3 situations work fine on the development machine.

Anyone has Master Pages + Update panels working properly on a production server?


We finally have solved the same problem. I think your case is similar.

Seehttp://forums.asp.net/thread/1653605.aspx for more info.


Hi korzh,

This is great, now it works like a charm! Thanks a lot for keeping me posted! Now, where in the documentation does it show anything about that property.. :P only a insider would know about it ..

Thanks a lot! Case closed!

Marcelo


Hi korzh,

This is great, now it works like a charm! Thanks a lot for keeping me posted! Now, where in the documentation does it show anything about that property.. :P only an insider would know about it ..

Thanks a lot! Case closed!

Marcelo

Ajax Update Panel not working...

hi,

I am using the below coding in Inline code..

<

body><formid="form1"runat="server"><div> <asp:ScriptManagerID="ScriptManager1"runat="server"></asp:ScriptManager> <asp:UpdatePanelID="UpdatePanel1"runat="server"><ContentTemplate>

<asp:ButtonID="Button1"runat="server"OnClick="Button1_Click1"Text="Button"/><asp:LabelID="Label1"runat="server"Text="Label"></asp:Label></ContentTemplate></asp:UpdatePanel>

</div></form>

</

body>

in code behind

protected

voidButton1_Click(object sender,EventArgs e)

{

Label1.Text =

"Refresh at " & DateTime.Now.ToString();

}

But when I run this page and click on the Button The Page is Posted back again and again..

Please Give quick answer it's urgent......

Thanks

Rocky..

Hi,

did you make the necessary changes to the web.config in order to enable ASP.NET AJAX?


yes ,

In web.config i fix

<

xhtmlConformancemode="Legacy"/>

but i still get the problem...


Hi,

did you apply all the other settings? Specialized sections, handlers etc. ?


will you please tell me briefly about all these settings so that my update panel will work...

if possible then code please for web.config file...

Thanks

Rocky


Hi,

please check theonline documentation topic.

As an alternative, you could compare your web.config with the one of the ASP.NET AJAX-enabled website installed as a Visual Studio template, and make the corresponding changes.


Any other setting I have to do except web.config documentation file in the web site and in eb.config??

Thanks

Rocky


Hi,

it should be enough. Be sure that you've referenced the System.Web.Extensions assembly in your website.

Monday, March 26, 2012

AJAX Toolkit installation

Forgive my ignorance, however today we are working on migrating an ASP .Net site to the web server that is running IIS6. We have installed AJAX onto the server and it seems to be working fine, however now I am getting errors with the AJAX toolkit. Our sys admin says that Visual Studio needs to be installed on the server to install the toolkit. Now I know this is not true, correct?

This is the error that we are getting. I double checked that the .dll file has been copied over to the web's directory bin file.

Parser Error Message:Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. The system cannot find the file specified.

Source Error:

Line 4: Namespace="System.Web.UI" TagPrefix="asp" %>Line 5:Line 6: <%@dotnet.itags.org. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AJAXTools" %>

Thanks for the information

Yes, you are correct, visual studio does not need to be installed on the web server.

Did you add a reference to the .dll file? Just putting it in the bin folder is not enough, you have to reference it once it is there.


I do have these directives on the default.aspx page:

<%

@.PageLanguage="VB"AutoEventWireup="true"CodeFile="Default.aspx.vb"Inherits="_Default" %>

<%

@.RegisterAssembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"Namespace="System.Web.UI"TagPrefix="asp" %>

<%

@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="AJAXTools" %>

Now, does the toolkit have to be installed on the web server? It already is installed on the development computer and is working fine. The actually error message is stopping at the AjaxControlToolkit Register Assembly statement.


Do you have the toolkit DLL as a reference in your web project?
Thanks for that information. I just added a reference and I will check it out tomorrow morning.

AJAX toolkit "access denied" problem

I am redesigning a site to include AJAX. On a new page that I created that contains a Tab Control, when I copy the page to the site's server, why would I be getting an "access denied" problem for a page that allows anonymous users? When I remove all references and controls for AJAX, it works fine.

Thanks for the information

Some more information on this problem...it seems as if it may be an IIS permission problem. All the AJAX controls run fine on the development machine, but in examining the website even further, any page with interaction, like a textbox with a watermark, I am getting Access Denied errors. Any help on this problem would be appreciated.

AJAX to grab a server controls RenderContents() output

Hi everyone,

My web application dynamically loads custom built server controls at runtime from seperate assemblies using the reflection namespace. Everything works fine, and the server controls display on the page as required.

I would like to extend this, to enable the server controls to be displayed asycronously. Is it possible to make an asynronous request to the web server and then when the server control is loaded, pass back the HTML that is generated in the RenderContents() method as the responseText?

How would I go about doing this? Example code would be great.

Any help is much appreciated,
Ad

Hi,

I'm still stuck on this on this one, any ideas?

Thanks again,
Ad


Hi,

Please refer to this:Emailing the Rendered Output of an ASP.NET Web Control, it implements the function you need.

Hope this helps.

NOTE:This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


This link looks like a good start, but a bit more sample code especially on the Ajax part would be very helpful.

Regards

Dion


Hi Dion,What probelms do you have after you've got the output of a control?

AJAX to do Server Side Validation without entire page postback

Hi,

I'm relatively new to ajax, but have an idea i'd like to try.

Is there any way to call a server side method that is able to access the values of items on a form, i.e post a form for validation, but without doing an entire page postback, and return a string with the validation results?

I'm having trouble figuring out how post a form without doing a postback.

Thanks in advance.

Chris

Hi,

The short answer is no. There's no way to "post" a form for validation without doing a partial postback which still causes the server lifecycle to be executed.


The solution that you're looking for is to execute a web service (or page method if you so chose) from client code that takes as parameters the current values of the form fields you're attempting to validate. You would execute the web service from client side JavaScript and grab the current values of your needed form fields also using JavaScript.

Look at the docs that describe executing a web service from client code.


Saturday, March 24, 2012

AJAX Timer doesnt work with page trace

Whenever I trace the output of my site, I get the following error: sys.webforms.pagerequestmanagerparsererrorexception. message from the server cannot be parsed. common causes of this error are when the resposne is modified by calls to response.write, response filters, httpmodules, or server trace is eneabled.

Error parsing near [timer1,1000], etc......

and it's an alert pop-up, that continues to alert every second after I close it. Its really annoying.


The site works fine when trace isn't eneabled, but obviously trace is needed for debug reasons.

I can catch the trace event in Page.Trace.IsEnabled, but how do I destroy or deactivate the timer, or the scriptmanager, or whatever it is that causing all these javascript alerts?

Hi bbaxter,

In general trace won't "play nice" with ajax (as it alters the page by appending the trace information to it).

I'd suggest taking a look atthis page to see how Microsoft recommends handling Debug and Trace situations when Ajax is involved.

You can use thetrace viewer to avoid appending the information to the page.

Add something like this to your web config

<configuration>
<system.web>
<trace enabled="true" pageOutput="false" requestLimit="50" localOnly="false"/>
</system.web>
</configuration>

And surf to http://yourapplication/trace.axd

I hope that helps.


Page level Tracing is not enabled if the page contains UpdatePanel, Instead use Trace.axd.

Well, see I have a page class that only sets trace=true when the url contains a ?trace=1 argument.

Can't I programmatically just ignore the update panel when trace=1, or using page.trace.isenabled in the page load?

Basically what I'm saying is on every page of our site adding ?trace=1 makes the trace enabled, this is useful for testing and live because you can see the debug information. Is there a way to just make the popups stop... popping up? the trace isn't the problem I suppose, the popups caused by the timer are.


Hi bbaxter,

Ah I see...I'd suggest looking at migrating to the suggested way of doing this. Any use of updates panels and trace will cause the errors you are seeing. There may be a way to eat those exceptions (I'm not aware of one) but it's not going to update the updatepanel, making it rather pointless.

I think the best way is probably to set the EnablePartialRendering property on your script manager to false wherever you're manually turning on tracing. That will eliminate the ability for updatepanels to do asynchronous postbacks. You probably also want to set the Timer.Enabled property to false or change its Interval to something longer as it'll cause regular postbacks that will refresh the page.

I hope that helps.

Wednesday, March 21, 2012

Ajax support on the hosting server

If I have an Ajax website that I want to copy to the hosting server,
But the hosting server didn't install AJAX,

Is it enough just to include ajax dll within my bin folder, and my web site will function well,
Or AJAX must be also installed on the hosting server ?

Thanks.

>> Is it enough just to include ajax dll within my bin folder, and my web site will function well,
>> Or AJAX must be also installed on the hosting server ?

The hosting Server should have AJAX installed. Otherwise your aspx pages uses AJAX controls will not work.


1. If the server has AJAX installed, I don't need the ajax dll at my bin folder ?

2. What about AjaxToolkit ? I just there is not server installation needed, just the DLL at my bin folder, amI right ?

3. By the way, what are the language extension folders been created under my bin folder, while adding reference to AjaxToolKit ?
If I need only English support, can I delete these folders ?
(And anyway, what these resource dll within these folders hold ? error text messages ?)

Thank you.


david79:

1. If the server has AJAX installed, I don't need the ajax dll at my bin folder ?

Yes, it's not needed. The assembly will be loaded from GAC.

david79:

2. What about AjaxToolkit ? I just there is not server installation needed, just the DLL at my bin folder, amI right ?

Yes, it's enough.

david79:

3. By the way, what are the language extension folders been created under my bin folder, while adding reference to AjaxToolKit ?
If I need only English support, can I delete these folders ?
(And anyway, what these resource dll within these folders hold ? error text messages ?)

Yes, you can delete them. Those satellite assembly contains all text messages for different language.

Ajax support by Web Hosts?

I currently use 1and1.co.uk as my web host on a shared server. i have an asp.net application under development and all is looking good. I would extend the look and feel for my application by using AJAX.

does my web host need to support AJAX or is it part of my application and when compiled will run on my host?

Thanks in advance

Matt A

As of Beta 1 and 2, the AJAX dll is part of the GAC, so a server admin needs to install it on the server, won't work like before where you had the dll in your bin dir.

Basically, you'll have to wait till your host adds AJAX support, which probably won't be till the final version is released...


Hi,

ASP.NET AJAX Beta2 is not a part of .Net Framework2.0,.

We are installing externally, in installation it will add "Microsoft.Web.Extensions.dll","Microsoft.Web.Extensions.Design.dll" to GAC.

Suppose if your webhost is not having AJAX Beta2, how can you run AJAX functionality at host.

If you want to use AJAX functionality there are two ways,

1) At the time of deployment you should add the two DLL to GAC,

2) Webhost must be installed AJAX Beta2

Pradeep Kumar Bura


Has anybody tried just copying the dlls to the bin directory of the website when using a third party web host? Any other workarounds out there?

JDG.