Showing posts with label firefox. Show all posts
Showing posts with label firefox. Show all posts

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

UpdatePanel and document.write

Hi,

document.write doesn't work with update panel. It works without update panel. That's for IE. document.write() kind of works in Firefox, but it clears all page content that was before document.write executed. Here is the code:

<%@dotnet.itags.org. 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 Button1_Click(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(GetType(), "hello", "hello();", true);
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script language="javascript" type="text/javascript">
function hello()
{
alert('Hello World!');
document.write('Hello World!');
placeholder.innerHTML = 'Hello World...';
}
</script>
</head>
<body>
<atlas:ScriptManager ID="ScriptManager" runat="server" EnablePartialRendering="true" />
<form id="form1" runat="server">
<atlas:UpdatePanel ID="p1" runat="server">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
<div id="placeholder"></div>
</ContentTemplate>
</atlas:UpdatePanel>
</form>
</body>
</html>

PS. forRegisterStartupScriptto work in firefox seehttp://forums.asp.net/thread/1239150.aspx

hello.

can you tell us what do you mean by doesn't work? i've copied your code and it seems like it's working with ie6...maybe i'm missing something?


I actually was testing it in IE7b2. But I just tested in IE6 and it still doesn't work.

The expected output of the above code:

message boxHello World!

Hello World!by document.write (this line is missing)

Hello World...set by placeholder.innerHTML property (works, but not in FF though)


hello.

well, i've tried it here and with firefox it seems to be working, ie, document.write replaces the content of the body with the string that is passed to it.

btw, the placeholder.innerHTML isn't working because it should be document.getElementById("placeholder").innerHTML.

Wednesday, March 21, 2012

UpdatePanel and Literal with IE 7 and Firefox

Hi,

I would use AJAX extensions for Visual Studio .NET 2.0 to enhance my website.

I created a MasterPage with 3 contentPlaceHolders, one column on the left for menus, one else on the top for title and one in the middle for the main content. In the the middle ContentPlaceHolder I put an UpdatePanel to refresh only this part of my website. In the UpdatePanel there is a Literal and I try to update the "text" property when the user click on the LinkButtons of the menu. The aim is to load external pages in the middle part as embedded objects without refresh or reload the whole page.

I have got two problems:

1. the whole page is reloaded when I click the first on any LinkButton, but the content of the update panel is well loaded.

2. when I click the second time on an other LinkButton, I've got this error (In French...)

Argument de publication ou de rappel non valide. La validation d'événement est activée via <pages enableEventValidation="true"/> dans la configuration ou via <%@dotnet.itags.org. Page EnableEventValidation="true" %> dans une page. Pour des raisons de sécurité, cette fonctionnalité vérifie si les arguments des événements de publication ou de rappel proviennent du contr?le serveur qui les a rendus à l'origine. Si les données sont valides et attendues, utilisez la méthode ClientScriptManager.RegisterForEventValidation afin d'inscrire les données de publication ou de rappel pour la validation

I tried to find the term "Page EnableEventValidation="true" " in my project but with no success.

But more strange, it works fine on Firefox 2.0. Only the middle part of the page is reloaded, and I've got no error on the second click.

And it is true when I try the tutorials: i.e. the Calendar tutorial, with IE 7 the whole page is reloaded but with Firefox only the UpdatePanel part is reloaded.

Here my code for the UpdatePanel

<div id="M_principal" style="left: 20%; position: absolute; top: 150px; background-color: #ffffcc; width: 80%; height:100%; vertical-align: middle;">

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="LinkButton1" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="LinkButton2" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
</ContentTemplate>
</asp:UpdatePanel>
</div>

CodeBehind (C#) :

protected void LinkButton1_Click(object sender, EventArgs e)

{
Literal1.Text = "<object type=\"text/html\" data=\"Page1.aspx?.html\" width=\"1000\" height=\"800\">";
}

protected void LinkButton2_Click(object sender, EventArgs e)
{
Literal1.Text = "<object type=\"text/html\" data=\"Page2.aspx?.html\" width=\"1000\" height=\"800\">";
}

If somebody have an idea to solve this problem...

Thanks.

EventValidation: Go to the @.Page directive at the top of the aspx-file (Source-view).

At the end of the directive, add

EnableEventValidation="false"