Showing posts with label page. Show all posts
Showing posts with label page. Show all posts

Wednesday, March 28, 2012

Why IsPostBack=false? How to repair that?

I'm using Ajax.Net. There is UpdatePanel on the page. It contains GridView. When I press "Edit", "Update" or "Cancel" button in the GridView then UpdatePanel reloads. Also executes code "if (!IsPostBack) { ... }" in Page_Load event on the server - but I don't need it!!! This code must run only once when page is loading for the first time.

protected void Page_Load(object sender, EventArgs e) {if (!IsPostBack) { ...// Here there are bindings for each control. // This code must run only once ...// On every action with GridView (which is placed in the UpdatePanel) // this code executes again and again. // Why? And how to prevent that? } }

1) Why IsPostBack=false (in Page_Load) on any action with GridView?

2) How to prevent that?

when you are clicking the button it's like you are reloading the all page but not the design... If you do not bind again the gridview loses data... Best solution is to cache the datatable that binds the gridview and binding the gridview to that... You can always verify the state of the grid to verify if you do some code...

As I understood, on every asynchronious postback (or mayme it's callback) the page is creating as it is not postback (isPostBack=false).

I think that it is better to use Session instead of Cache because every user has it's own data in the tabe.


cache in client... it's not postback... because the reference it's different... when you have difficulties test without the updatepanel to see if it's another reference of the page or not...

and i know what you're thinking the adress it's the same... it's ASP my friend... works that way.


What means "cache in client"? How? I can cache data only on server.


HttpContext.Current.Cache.Insert(itemString, Obj, HttpCacheability.Public, DateTime.Now.AddHours(expiration), TimeSpan.Zero)



Oh, it's caching on the server side, I thought you means caching data on the client side.

I change a bit my question. So, on each asynchronious postback executes code "if (!IsPostBack) { ... }" in Page_Load. But I want to prevent it. This code must executes only once when page is loading for the first time. How can I know if the page is loading for the first time or it is asynchronious postback? I want something like that: "if (!IsPostBack && !isAsynchroniousPostBack) { ... }"


did you tried with page.callback?


most likely no. what do you mean?


Put if not ispostback and not iscallback...


I wrote "!IsPostBack && !IsCallback && !IsAsync" - IsCallback and IsAsync always =false. IsPostBack in some cases =true and in some cases = false


tell me what are the cases that give true...

you don't have the need to put all of this...

if it doesn't control for you the postback you can put a viewstate that keeps the state of the grid.

just like this:

If not ispostback and viewstate("Should_Enter_Here")

end if

and in the event of the grid put this viewstate equals a true.


What you are looking for isIf (!ScriptManager.GetCurrent(Page).IsInAsyncPostBack).

http://www.asp.net/learn/ajax-videos/video-173.aspx


Thanks

Why javascript function can not be found in Firefox with a AJAX page?

Following page works fine with IE. When click on Html button, the javascript function is called and works fine.

But when run the same page in Firefox, it reported that the error as below:

myFunction is not defined

onclick(click clientX=0, clientY=0)

What's the possible reason and how to solve it?

--the page code:the page also include some Ajax toolkit and the code for that is omitted.

<%@dotnet.itags.org. Page Language="vb" AutoEventWireup="false" Codebehind="workshop.aspx.vb" Inherits="my.workshop" %>
<!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>Workshop Registeration</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<link href="http://links.10026.com/?link=StyleSheet1.css" rel="stylesheet" type="text/css" />
<script type="text/jscript" language="javascript" >

function reset(){
document.workshop.reset();
}

function myFunction() {
alert("test");
}

</script
</head>
<body class="page">
<form id="workshop" runat="server">
<asp:ScriptManager runat="server" EnableScriptGlobalization="true" ID="MasterScriptManager"
EnablePartialRendering="true" ScriptMode="Release" AsyncPostBackTimeout="72000">
</asp:ScriptManager>
<div>
<table border="1" cellpadding="0" cellspacing="0">
<tr class="namearea">
<td align="center" class="dataarea">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="right" style="width: 50%">
<input class="jsbutton" onclick="javascript:myFunction();" type="button"
value="Button1" />
</td>
<td align="left" style="width: 50%; background-color: White;">
<br />
<asp:PlaceHolder ID="plcmyHolder" runat="server"></asp:PlaceHolder>
<br />
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

Change the script type from text/jscript to text/javascript and it'll work.

why Javascript doesnt work properly in updatepanel?

i wanna my gridview to change into editrow model by click any space in the row , so i wrote in the aspx page:

.....
<script type="text/javascript">
function ClickEvent(cId)
{
var id=cId;
document.getElementById("rowid").value=id;
document.getElementById("btnBindData").click();
}
</script>
.....

<asp:LinkButton ID="btnBindData" runat="server" OnClick="btnBindData_Click" Width="0px" style="width:0px; height:0px"></asp:LinkButton>
<input type="hidden" id="rowid" runat="server" /> //send clicked row index to editindex property

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
OnRowDataBound="GridView1_RowDataBound">
<Columns>
<asp:BoundField DataField="userName" HeaderText="userName" SortExpression="userName" />
<asp:BoundField DataField="userPassword" HeaderText="userPassword" SortExpression="userPassword" />
</Columns>
</asp:GridView>

In the aspx.cs file i wrote:

.......

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{

e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#dfe345'");

e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");

e.Row.Attributes["style"] = "Cursor:hand";

e.Row.Attributes.Add("OnClick", "ClickEvent('" + e.Row.RowIndex + "')");

}
}

......

protected void btnBindData_Click(object sender, EventArgs e)
{
GridView1.EditIndex=Convert.Int32(this.rowid.Value);

.....

GridView1.DataBind();
}

It works well without UpdatePanel ,but when put the GridView in the UpdatePanel ,when I click the row, the GridView got disappeared.

Replace asp:LinkButton with asp:Button. If you want you can sorround your button with a hidden div (to hide from the user). Also add UseSubmitBehavior="false" to the asp:Button.

For example:

<div style="display: none; line-height: 0pt;">
<asp:Button id="btnBindData" runat="server" OnClick="btnBindData_Click" UseSubmitBehavior="false" />
</div>

why page load is called when an updatepanel is updated

Hi,

i have just observed that when a request is posted to server inside an updatepanel. then load method of page is called.

create a page with script manager and updatepanel. put a button inside the panel. add a msgbox in the load eventhandler of page.

now when u will click the button page load eventhandler would be executed. i was expecting that only the load event of update panel would be executed not the page one. because what ajax says is that whole page is not reloaded only the updatepanel is reloaded. does it mean that the ajax only helps to not activate the back button on browser but underlying it reloads the page in fact.

thanks

Hi i think you misunderstood something. what AJAX meant for is not exactly for asynchronous postbacks. This means that you cant execute two threads parallelly. But what it does is partial rendering. During an async postback all the usual events will be executed but only the contents inside the Update panel will be rendered.


hello.

well, what they're trying to say is that only the updatepanel contents will be updated during a partial postback. you can use the scriptmanager isinasyncpostback property to see if you're in a partial postback scenario:

http://asp.net/AJAX/Documentation/Live/mref/P_System_Web_UI_ScriptManager_IsInAsyncPostBack.aspx


rex_alias:

Hi i think you misunderstood something. what AJAX meant for is not exactly for asynchronous postbacks. This means that you cant execute two threads parallelly. But what it does is partial rendering. During an async postback all the usual events will be executed but only the contents inside the Update panel will be rendered.

I'm pretty sure that's exactly what AJAX is meant for.

And you can execute two threads parallelly.

Partial rendering isn't related to AJAX, you can have partial rendering without AJAX, and you can have AJAX without partial rendering, although it's implemented in the UpdatePanel and its implementation uses AJAX.

And yes, the whole life cycle of the page happens on the server, but only the relevant portions of the output are rendered into a xml based diff-gram, and sent to the client.


This is the nature of Update Panel. You can filter out the Regular Post Back with an Async by Checking the Page ScriptManager.IsInAsyncPostBack. Or if you do not want to page to be called then use the Client Centric Development Model which is calling the Web Service or Static Page Methods.

Why Response.Redirect() opens up a new browser window in AJAX?

I have an AJAX enabled page displayed in amodal dialog, When I click on a button that has a Response.Redirect() code, a new browser window gets opened, which is weird and not the behavior that I expect.

I should note that this page worked properly before adding the AJAX related stuff.

I highly appreciate any insight into this problem.

try use server.transfer


I had already tried the Server.Transfer but I got a client side alert: "Sys.WebForms.PageRequestManagerParserErrorException: The message recieved from the server could not be parsed,..."
Try to navigate to next page in Javascript instead of on Server side. I think this can solve the issue.

hello.

i think the problem is that submitting a page on a popup will open another window by default. you can workaround this by adding an iframe to your popup window which loads the page you need.


Thanks, I think the only workaround to my problem was to use the IFrame in the modal window, but still, I'm wondering why the use of Server.Transfer() caused the error in AJAX, and, why the Response.Redirect() would open up a new window, was I missing somthing or it's just the way AJAX works!

May I ask that Response.Redirect is logical/possible at all during a partial postback (for example in an updatepanel's button click event)?!

Simply move that specific button which yield Response.Redirect outside of the updatepanel, maybe it helps.


Yes, the button which yielded the Response.Redirect() or Server.Transfer() for that matter, was inside the UpdatePanel, I moved it outside the UpdatePanel and my problem was solved. Actually the UpdatePanel was inside a Container UserControl, I think I should make use of UpdatePanel more narrowly focused.

Thank you very much indeed.


response.redirect will be correctly interpreted by the ajax platform. you can check this by using ?a "normal" page. the problem that was happening here was related with modal dialogs and the issue described is not an ajax problem.

server.transfer won't work correctly with ajax and shouldn't be used from controls placed inside the updatepanel. this is understandable because partial postbacks expect to receive a predefined message from the server and whe you do a server.transfer you end up retunring a new page to the user which doesn't conform to the expected message.

So response.redirect works with ajax.

If ajax open the redirected page via javascript (maybe using window.open( ... ) ), that can be a problem.

Modern tabbed browsers are configurable how to treat popup pages from normal links or from javascript (new window, same window, new tab, disable totally javascript popups etc.)

I recommend for Robert to try the page in firefox, and play with advanced firefox settings (type about:config in the address bar, and play with "browser.link.open_newwindow.restriction" and similar settings, you can google for help how it works)

ps:

If the button must be in the updatepanel, maybe it is possible to register a script in the server side which open the new window by javascript (a more controlled way.)


I am also running into this problem and am unable to place the control outside of the Update Panel. I am not clear as to how an IFrame would be implemented. Is it meant that an IFrame should be used in place of the AJAX update panel or in addition to? How would this implementation work specifically?

Thanks for any information in advance.


MaybeScriptManager.RegisterPostBackControl could be used to eliminate this problem in some cases.

So leave your button (which has the codebehind redirect logic) in the updatepanel, but use the RegisterPostBackControl method so it will cause a full normal postback. That way you have a normal redirect, not the ajax client side redirect.


Thanks for the responses.

I did try the following on the control that is being clicked to fire the Redirect:

ScriptManager1.RegisterPostBackControl(this.testButton);

Unfortunately, this still launches a new window during the redirect.

Does anyone have any other ideas as to how i can do this? I would be open to attaching some javascript to the button in order to perform the redirect, however, I have already tried adding the following with no success:

ScriptManager.RegisterClientScriptBlock(this.buttonTest,this.buttonTest.GetType(),"Redirect","window.location = 'http://www.testpage.com'",true);


jriell:

I have already tried adding the following with no success:

ScriptManager.RegisterClientScriptBlock(this.buttonTest,this.buttonTest.GetType(),"Redirect","window.location = 'http://www.testpage.com'",true);

If you choose that way (custom client side redirect), I recommend the following to try:

Put a regular input button, link etc. in the updatepanel, for example:

<input type="button" value="test" onclick="window.location.replace( 'http://www.testpage.com' );" />

If that works, try the script withthe RegisterClientScriptBlock stuff.

Why ScriptManager in MasterPage is not enough to the toolkitExtender control?

This is the error I get when look on a page and drop the User control that include the ajaxTooltip from any type.

Any suggestion?

The Error

Do you use ScriptMangerProxy?you need to use ScriptManager/ ScriptManagerProxy both for master page.

Where to add the ScriptManager and where to add the ScriptManagerProxy to get a clear design time project developing?

To explain the controls, pages, masters I have, here are they:

1. A master page that include a ScriptManager (I try to include a ScriptManagerProxy also).

2. A page that inherit the MasterPage and have a User Control in it by design time(drag and drop).

3. A User Control that have a modalPopupExtender in it, that work properly.

My only problem that other developers use my User Control in them Pages and the User Control(that added to the page) raise a:

Error Rendering Control

An unhandled exception has occurred.

The control with ID 'MpdalPopupExtender1' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.

What can I add to the Page, Master or may be web.config?

why script enabled webservice making postback to server?

My WebPage has two textbox & one button.On button click I call script enabled webservice asynchronously still why my page go for postback to server?

<%@dotnet.itags.org.PageLanguage="C#"AutoEventWireup="true"CodeFile="page2.aspx.cs"Inherits="page2" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Untitled Page</title>

<scriptlanguage="javascript"type="text/javascript">

<!--

function Button1_onclick()

{

ret= WebService.Hello(document.getElementById('TextBox1').value,OnComplete,OnTimeOut,OnError);

return(true);

}

function OnComplete(args)

{

document.getElementById('TextBox2').value=args;

}

function OnTimeOut(args)

{

alert('Timeout');

}

function OnError(args)

{

alert('error');

}

// -->

</script>

</head>

<body>

<formid="form1"runat="server">

<div>

<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox>

<asp:ButtonID="Button1"runat="server"Text="Button"OnClientClick="Button1_onclick();"/>

<asp:TextBoxID="TextBox2"runat="server"></asp:TextBox>

<asp:ScriptManagerID="ScriptManager1"runat="server">

<Services>

<asp:ServiceReferencePath="WebService.asmx"/>

</Services>

</asp:ScriptManager>

</div>

</form>

</body>

</html>

===============================================

WebService

using System;

using System.Web;

using System.Collections;

using System.Web.Services;

using System.Web.Services.Protocols;

///<summary>

/// Summary description for WebService

///</summary>

[WebService(Namespace ="http://tempuri.org/")]

[WebServiceBinding(ConformsTo =WsiProfiles.BasicProfile1_1)]

[System.Web.Script.Services.ScriptService()]

publicclassWebService : System.Web.Services.WebService {

public WebService () {

//Uncomment the following line if using designed components

//InitializeComponent();

}

[WebMethod]

publicstring Hello(string msg) {

return"Hello"+msg;

}

}

function Button1_onclick()

{

ret= WebService.Hello(document.getElementById('TextBox1').value,OnComplete,OnTimeOut,OnError);

return false; // return(true); you need to return false instead of true. if you return false it doesn't do post back.

}

Thanks,

Kiran


Still same condition it does post back.I tried same application with HTML controls textboxes & button it works fine but when I tried with server side control it posts back


Hi,

can you post code that you used for testing.

Thanks,

Kiran


here is code with HTML textboxes & button for same script enabled webservice

<%@.PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Default" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Untitled Page</title>

<scriptlanguage="javascript"type="text/javascript">

<!--

function Button1_onclick()

{

ret= WebService.Hello(document.getElementById('Text1').value,OnComplete,OnTimeOut,OnError);return(true);

}

function OnComplete(args)

{

document.getElementById('Text2').innerText=args;

}

function OnTimeOut(args)

{

alert('Timeout');

}

function OnError(args)

{

alert('error');

}

// -->

</script> </head>

<body>

<formid="form1"runat="server">

<asp:ScriptManagerID="ScriptManager1"runat="server">

<Services>

<asp:ServiceReferencePath="WebService.asmx"/>

</Services>

</asp:ScriptManager>

<div>

<inputid="Text2"type="text"/>

<inputid="Text1"type="text"/>

<inputid="Button1"type="button"value="button"language="javascript"onclick="return Button1_onclick()"/>

</div>

</form> </body>

</html>


Hi,

function Button1_onclick() still returns true.

did you change it to return false. and tried it.

Thanks,

Kiran


yeah.......I did change it to false & tested it ,it does post back .The code which I posted doesn't postback but its withHTML control which works fine & I am trying to do same webservice code but with server control.

Hi,

can you change below code

<asp:ButtonID="Button1"runat="server"Text="Button"OnClientClick="Button1_onclick();"/>

to

<asp:ButtonID="Button1"runat="server"Text="Button"OnClientClick="return Button1_onclick();"/>

make sure that function is called. keep alert message in Button1_onclick function so you know that function got invoked when you click Button1_onclick.

Thanks,

Kiran


Thank you Kiran it works just fine.But I didn't get difference b/nButton1_onclick() & return Button1_onclick() could you please explain it?

Thanks

Manisha.


event = "return function()" if function returns false the event gets canceled.

if your case we are forcefully canceling onclick event by returning false.

event = "function()" doesn't matter what function returns.

Thanks,

Kiran

Why slow UI with AJAX?

I am working on a page that displays paged ResultSet from a database. I created the page without AJAX update panels. Later I added those to ajaxify my application. The problem is when I change pages in my GridView the time it takes for it show the new results (using Asynchronous postback) is about 4 secs more then a regular postback.

Does any one know why it is slow. I usedfiddler tool to check the response size and Asynchronous postback does come back with less number of bytes but why slow UI update?

Thanks for your help.

The thing that will effect your AJAX postback the greatest is the size of your ViewState.

Comment out your update panels & script manager and then enable tracing for your page.<% @.Page Trace="True" %>The trace information will show you exactly how large your ViewState is for that page. Try paging through your GridView and see if you ViewState size grows as you page. Even if the size doesn't grow, if the initial ViewState size for your page is very large, it will cause long delays between AJAX postbacks. If you do find that your ViewState is huge, or it grows between postbacks, try to figure out which controls you can disable the ViewState for (EnableViewState="False") or what might be causing your ViewState bloat.

Just as an FYI, I have used UpdatePanels with GridViews in many different cases without a problem. I did have to tune the ViewState for some of the pages I made to speed things up, but it can definitely be done and it works great.

-Aaron


I am totally agree withSchnieds , that you have to disable the viewstate wherever it is not necessary..

Do one more thig also..try to set <compilation debug = "false" > in web.config

Hope it will help you.Smile


Thanks for your replies. I tried to turn the viewstate off for the gridview but then my pagging gets all screwed up. I have a dynamic paging option where user can select the number of results displayed per page. When I turn off the viewState it gets set to the default value (which is 14) and the page index gets set to 1.

Any ideas?

P.S.: I do have the <compilation debug="false" />


You probably won't be able to disable the ViewState for your GridView, but you may be able to disable it for other controls on your page and decrease the overall ViewState size.

Turn on tracing as I suggested, figure out what control(s) have a large ViewState and look for the other things I mentioned in my previous post. You should be able to determine what is causing your ViewState bloat very easily with the tracing turned on.

-Aaron

Why Sys.WebForms.PageRequestManager only with UpdatePanel?

Why do I only get access to Sys.WebForms.PageRequestManager if I have an updatepanel in my page? I have some really good uses for this method, but right now I only get access to the object if I include an UpdatePanel in the page.

If I want to include this when I have my control in the page, what is the parameters needed to extract it from the resources using Page.ClientScript.GetWebResourceUrl ?

In the RTM version (due out by the end of this month), Sys.WebForms.PageRequestManager will be available even if you don't have an UpdatePanel on the page. In the mean time, I recommend just putting an empty one on the page: <asp:UpdatePanel runat="server" />.


Perfect !

Wow - glad I found this post, that was going to be a long, painful and probably fruitless debug session otherwise. Thanks for that!

PS. Anyone know *why* this is the case?

Why Sys.Application does not work?

I just begin to learn ASP.NET AJAX. I have a simple question, please bear with me. I want to test client-side page life cycle. Here is my code. I don't know why pageInit does not get called? But pageUnload works.

Thanks a lot!

<head runat="server">
<title>Untitled Page</title>

<script type="text/javascript">
<!--
Sys.Application.add_init(pageInit);


function pageInit()
{
alert("Enter init page.");
}


function pageUnload()
{
alert("Page unloaded!");
}
//-->
</script>
</head>
<body>
<form id="form1" runat="server">

.....

Try putting your Sys.Application.add_init(pageInit) *after* you've defined your pageInit function.


I think I got a error that Sys is undefined. Did I miss including any namespace?

Thanks again!


The problem is fixed. I need to move <script> section after <asp:ScriptManager ID="ScriptManager1" runat="server" />, so that Sys can get reference.


I expierence the same problem, IE7 throws a javascript error "sys is undefined".

I did like you described and put the <asp:ScriptManager> section before my first <script> tag, but it doesn't help.

Have to put the ScriptManager section into my masterpage aspx file because of the <form> tag, could this be the problem?
In the browser output file of my aspx there are still <script> tags above the ScriptManager.

What can I do on this?


Check out this post for ideas about why you might get "sys is undefined":http://weblogs.asp.net/chrisri/archive/2007/02/02/demystifying-sys-is-undefined.aspx.

I guess it probably is the web configuration issue. Create a new AJAX-based web project, copy its web.config to your project to see if it works.

Why the value always is false?

Following is my codes. No matter I login or not,the userLoggedIn always be false. Why?

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" Codebehind="WebFormTest.aspx.cs" Inherits="EdtungWeb.WebFormTest" %><!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
<script language="javascript" type="text/javascript">
// <!CDATA[ function Test() { debugger var userLoggedIn = Sys.Services.AuthenticationService.get_isLoggedIn(); } // ]]> </script
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
</div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="Test()" />
<asp:Login ID="Login1" runat="server">
</asp:Login>
<asp:LoginStatus ID="LoginStatus1" runat="server" />
</form>
</body>
</html>

and the loginstatus is retrieving the right information?


Yes, it is, the loginstatus is retrieving the rightinformation.

Many thanks for your replying.

Unless you use the AuthenticationService to Login the user it will remain false. One hack might be to inject the following line in your pages from the server side when you are sure the user is logged in.
Sys.Services.AuthenticationService._authenticated = true;

I see.

Many thanks for your replying.


Would you mind marking that as answer.

Sorry for that.

Many thanks for your remind.

Wierd behavior with the ratings control

I noticed that the hyperlink on the stars within the ratings control points to "#". On the samples page it works fine, however, on my page, when you rate, the page gets anchored to the top.

What is the reason for this problem? I have set the EnableAutoPostBack propery to false, so that is not an issue here. The page does not refresh(there is no postback), but the page anchors to the top.Any tips?

Thanx.

Premal.

Hi Premal,

Would you please provide asimple repro and youAjax Control Toolkit's Version? Without these, I'm afraid that we cannot figure out the exact root cause.

Best regards,

Jonathan


What is simple repro?

Premal.

Wierd Error if page is left alone for too long... (ajax pages)

I have a wierd error that only occours if there has been no interaction with the webserver for too long. (over 30 mins)

The specific error that is returned is

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occoured while processing the request on the server. The status code returned from the server was: 504

This seems to happen to any page that has a script manager and update panel in it. I have tried adjusting the session timeout period, but this doesn't seem to help. It is almost like the page is loosing it's reference to the script files required by the ScriptManager. Is there some caching parameter I could add to the page to extend the cache time?

Any other ideas are welcome. This is a strange one. So far the workaround is to add a timer to the page that just keeps it alive.. (updates the page every minute or so with a meaningless value...)

TIA

Rob

See:http://forums.asp.net/p/1134743/1809108.aspx#1809108

-Damien


Hi,

Please see this post:504 Gateway Timeout occuring for very small number of users

504 Gateway Timeout
The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server it accessed in attempting to complete the request.

Best Regards

Monday, March 26, 2012

Will Atlas Work With Opera 8.60 for Pocket PC?

myAtlas Update Panels are working fine when i access the page from a standard desktop Opera browser. However the page is posting back when i do the same thing from within the PDA. the PDA is running the latest 'Opera 8.60 for Pocket PC' browser.

can i somehow configure the Atlas or the page so that it will work on the PDA browser? or am i on a hiding to nothing?

thanks

I don't speak for the ASP.Net team; however at this time there is no real 'support' for mobile devices (so yours being opera is not a slant). Currently there is some Opera desktop browser support and they are looking at expanding it. As with all new tools we get to play with - mileage will end up varying - however if you are familiar with Java Script... there may be a means for you to roll your own if its a mission critical scenario... However, personally - I don't think right now the focus is in provding mobilie support as it is more inline to polishing desktop browser experiences... NOt to sy it won't won't happen.. but usually mobile applications don't rely on the jazzability that memory / cpu intensive desktop browsers can utlize...

Will using Update Panel really give any performance improvements compared to non-AJAX site

Hi,

When one uses the Update Panel to remove the browser refresh then will there be any real performance gains as it yet does a full page postback and goes through the complete page life cycle on the server?

Using Update Panel sure makes the end user feel as though the browser refresh has been removed. But is there anything more to it?

Thanks,

- Manoj

Hi,

if you want to know more about this I would like to recommend you to check out this video that was shot on TechEd 2006 Barcelona:http://www.microsoft.com/emea/msdnshowtime/sessionh.aspx?videoid=331.

It shows the good and the bad of the UpdatePanel and how to tweak it.

Grz, Kris.


hello.

and the obvious answer is that it's not there to increase performance :)

Win CE Support

Hi,

I'm developing a site for Win CE, which uses a version of IE6. I'm wanting to do partial page updates, but this functionality does not appear to be working. I'm using MS Ajax RC 1.0. I'm using a update panel coupled with a timer control which updates a grid at a regular time interval. This works fine on my development machine and other systems on IE6 & IE7, but in Win CE i get a full page update. There are no errors, but the partial update functionality is not working as it should. Any insight?

Thanks,

Josh

PocketPC and Smartphone devices 2003 and later, support AJAX. Read more about it here - http://blogs.msdn.com/iemobile/archive/2005/11/15/493200.aspx

Hi - thanks for the information. Looks intriguing. I take it that the MS AJAX controls are not supported?

Thanks again,

Josh

Window Pop up effect

I am trying to mimic the pop up effect on the Ajax showcase page. Moving the mouse over a link pops up a new window.

Is this done thru a particular AJAX extension/control or is it just a javascript pop using a hidden div

Thanks

You can use the hovermenu control from the AjaxControlToolkit to do the same...

Window Pop up effect

I am trying to mimic the pop up effect on the Ajax showcase page. Moving the mouse over a link pops up a new window.

Is this done thru a particular AJAX extension/control or is it just a javascript pop using a hidden div

Thanks

Umer

uriaz:

Is this done thru a particular AJAX extension/control or is it just a javascript pop using a hidden div

The showcase uses theDropShadow and theHoverMenu from the Control Toolkit, both of which are placed inside a standard ASP.NET Repeater control.
thnkas works like a charm
thanks works like a charm

window.onload event handler not firing on web page (AJAX BETA 2)

Any help on this one would be greatly appreciated. I'm new to Ajax and hopefully this will be a simple fix - i'm probably missing something obvious.

I have a simple website with a master page : SiteMaster.master. Inside here I've referenced the ScriptManager component
I've a simple content page which references the ScriptManagerProxy to include its own custom javascript - note no event handlers or listeners in here

The master page contains a number of controls that need to be resized immediately after the page loads and also when the page resizes

<asp:ScriptManagerID="smDefaultMaster"runat="server"EnablePartialRendering="true"ScriptMode="Release">
<Scripts>
<asp:ScriptReferencePath="~/Scripts/siteMaster.js"/>
</Scripts>
</asp:ScriptManager>


In the siteMaster.js I have 2 functions defined and I add handlers for these as per the new Sys.Dom.UI.AddHandler Methods in Beta 2. For some reason the pageLoaded event is never raised. The resize event works fine. Am i doing things correctly or am i messing something up.

function

pageLoaded () {
alert ("Load");
}

function pageLoaded () {
alert ("Resize");
}

$addHandler (window,'load', pageLoaded);
$addHandler (window,'resize', pageResized);

In the docs onthis page, you can read this:

During ordinary page processing in the browser, thewindow.onload DOM event is raised when the page loads initially. Similarly, thewindow.onunload DOM event is raised when the page is refreshed or when the user navigates away from the page.

However,these events are not raised during asynchronous postbacks. To help youmanage these types of events for asynchronous postbacks, thePageRequestManager manages a set of events that are similar towindow.load and other DOM events, but that also occur for asynchronous postbacks. For each asynchronous postback, all page events in thePageRequestManager class are raised and any attached event handlers are called.

Maybe it does help you.

Greets,
Nils Gruson

Window.OnLoad and callback problem

Hi,

I have a Javascript function that fires every time the page loads: triggered by the event window.onload...

Now i use an updatepanel and i need that function to be fired every time the callback occurs...

Wich is the event i should use?

Is there something like window.oncallback ?

Thanks in advance.

Antonio Li Causi.

Well, no. First, if you're using the ASP.Net ajax framework anyway, you're better off writing a function called pageLoad; the framework looks for it and fires it once everythign's done and ready to go on the first load. It's better than window.onload for this b/c it's coordinated w/ everything else the framework is trying to do for you.

In that pageLoad() method, you want to enter the line: Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoadedHandler) where pageLoadedHandler is the name of the function you want to fire when the page loads after async callback.

Example is here:http://ajax.asp.net/docs/ClientReference/Sys.WebForms/PageRequestManagerClass/PageRequestManagerPageLoadedEvent.aspx


Check this:ASP.NET AJAX Client Life-Cycle Events

and especiallypageLoaded Event