Showing posts with label mode. Show all posts
Showing posts with label mode. Show all posts

Monday, March 26, 2012

UpdatePanel - Wits End - Take Pity

i have an UpdatePanel with mode="Conditional". when a button within the UpdatePanel is clicked it is firing an Atlas partial postback.

i am trying to register a script on each postback. but when the partial postback occurs my script is not getting refreshed. my script is attempting to register itself in Page.PreRender. below is the code in case that it important. please help - im at my wits end with this - thanks

if (!Stopwatch.IsTicking)

script ="var isTicking='F';var hrs=0;var mins=0;var secs=0;";

else

{

TimeSpan timeElapsed =Stopwatch.TimeElapsed;

script ="var isTicking='T';var hrs=" + timeElapsed.Hours.ToString()

+";var mins=" + timeElapsed.Minutes.ToString() +";var secs="

+ timeElapsed.Seconds.ToString() +";";

}

Page.ClientScript.RegisterClientScriptBlock(Page.GetType(),"SWVars", script,true);

Hi,

try to use Page.ClientScript.RegisterStartupScript() instead. Inline scripts in an UpdatePanel are not loaded after a partial postback.


Nope. Hasn't made a difference. Any other suggestions?

Try using Fiddler or Nikhil's Web Dev Helper to do an HTTP trace and see if your script is getting sent down to the client at all.

If it's being sent down, try adding the "debugger;" statement to the top of your script to launch the debugger the moment it's executed (it works in IE, not sure about other browsers).

If it's not being sent down, well, I'll take another look :)

Thanks,

Eilon


When I install Fiddler I get an "unknown error" popup when i click the button within my updatecontrol.

when i uninstall Fiddler this message goes away?


ignore. ive fixed this problem now.

What was your solution to this. I've come across this same problem. Thanks.


i used RegisterClientStartupScript. as it happens the problem was down to my javascript. the javascript ran ok without atlas but i needed to tweak it slightly to run with atlas.

my advice to you is to check your javascript.


If you're using ClientScript.RegisterXxx() and you've simplified your JavaScript down to something that still doesn't work, please share snippets of your code and I'll be glad to take a look.

Thanks,

Eilon


When you have ClientScript.RegisterClientScriptBlock, there is something about the order in which the script is executed, related to Atlas scripts.

As far as I can remember, if you are using an UpdatePanel, your script executes after Atlas scripts.

If you are not using an UpatePanel it executes before.

Saturday, March 24, 2012

UpdatePanel and client-side script error in IE, but not in Firefox

<atlas:UpdatePanel runat="server" ID="up" Mode="Always">
<ContentTemplate>
All sorts of controls here
</ContentTemplate>
</atlas:UpdatePanel
I have two DropDownLists. When the user selects an item in the first DropDownList, there is a postback and the 2nd DropDownList gets populated.

All works fine in Firefox 1.5.0.1.

In IE 6, I get this client-side error:
"Assertion Failed: elements in children collection should always have nodeType = 1
Break into debugger?"

And if I break into debugger, the only line is:
"debugger;"

Thanks.Dear,

I have this problem now :)

[],

Ramon Dur?es
It would be nice to post a complete code or at least something distilled down to generate the same error. Both posts claim some issue, but without the code it's difficult for others to investigate this problem.
OK, this was not easy to reproduce. It's a crazy bug :)

<%@. Page Language="C#" %
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<script runat="server">
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
this.DropDownList2.Items.Add(new ListItem("xyz"));
}
</script
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<atlas:ScriptManager ID="sm" runat="server" EnablePartialRendering="True" />
</head>
<body>
<form id="form1" runat="server">
<div>
<atlas:UpdatePanel runat="server" ID="up" Mode="Always">
<ContentTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" AutoPostBack="True">
<asp:ListItem>abc</asp:ListItem>
<asp:ListItem>def</asp:ListItem>
</asp:DropDownList><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="DropDownList1"></asp:RequiredFieldValidator>
<br />
<asp:DropDownList ID="DropDownList2" runat="server">
</asp:DropDownList>
<!-- remove this to make UpdatePanel work in IE -->
</ContentTemplate>
</atlas:UpdatePanel>
</div>
</form>
</body>
</html
Just remove the HTML comment, and it works!
Hi,

please checkthis thread.
Hi

I have had this problem with the March release. removing thecomments did resolve it. However i dont understand why this is?
I guess its not a big problem to simply not comment in the html but still seems like a strange restriction.

Garbin. You mention in the other thread that the release fileswill not do this and recommend to reference them? I dont follow, i addthe script folder to my project and create a reference to thedll. Then in the config file....
<add tagPrefix="atlas" namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Atlas"/>
<add tagPrefix="atlas" namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Atlas"/
How do i specifically refrence the release js files?

thanks
o
I got the same problem. I have the latest dll and took all the comments off the page.

I have this textbox that when it posts back it finds the client. If I use it with Firefox it works (after I took off the comments), but if I use IE, it does the search but it freezes up and never shows the information.

Thanks.
Hi,

you could use the ASP.NET notation

<%-- This is a comment --%>

to make comments inside an UpdatePanel.
Now I don't get the error message, but the page freezes up.

I'm using master page, and when I use regular page it works fine and all the fields are completed, with the master page, it finishes the search and that's it, no error message at all.

Thanks.
Hi,

the problem may be related to the id of a control being modified by its container (the MasterPage), but I'm just guessing. Could you post some code?
Thanks for your answer Garbin.

I don't know if this is relative or not, but the master page was using MagicAjax, so I just deleted the MagicAjax Panel from it and it worked.

My guess is the MagicAjax javascript was modifying something. Now it works.
I have the problem too.
and I a another problem.
when I use UpdatePanel on the webPart Zone Control.one webpart zone left a Updatepanel,but when I drop the webpart from a webpart zone area to another.
there will show the message:
"Assertion Failed: Duplicate use of id "WebPart_gwpBookConsumer1" for object of type "Sys.UI.Controls.WebParts.WebPart".Break into debugger?"

The problem exists in Firefox too.

thanks.
same problem here

This is a known issue, and we are currently investigating. See this thread:http://forums.asp.net/thread/1232325.aspx

-Mike


Is fixed in the Atlas April CTP:http://weblogs.asp.net/atlas/archive/2006/04/10/442437.aspx

-Mike