Welcome Guest Search | Active Topics | Sign In | Register

Callback and tree view post back problem and populate on demand Options
Jhon s
Posted: Tuesday, September 11, 2007 12:32:17 AM
Rank: Advanced Member
Groups: Member

Joined: 5/31/2007
Posts: 36
i have a tree inside a callback and a button that triggers the callback, when setting the globalization to "tr-TR" and populating the tree on demand and trigerring the callback it throws an error -
"The state information is invalid for this page and might be corrupted."

please look at this code:
<%@ page language="C#" autoeventwireup="true" codefile="Default.aspx.cs" inherits="_Default" %>

<%@ register assembly="EO.Web" namespace="EO.Web" tagprefix="eo" %>
<!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">
<eo:callbackpanel id="CallbackPanel1" runat="server" triggers="{ControlID:Button1;Parameter:}">
<asp:button id="Button1" runat="server" text="Button" />
<eo:treeview id="TreeView1" runat="server" height="250px" width="200px" controlskinid="None"
onitempopulate="TreeView1_ItemPopulate">
<looknodes>
<eo:treenode collapsedimageurl="00030301" disabledstyle-csstext="background-color:transparent;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;color:Gray;padding-bottom:1px;padding-left:1px;padding-right:1px;padding-top:1px;"
expandedimageurl="00030302" imageurl="00030301" itemid="_Default" normalstyle-csstext="PADDING-RIGHT: 1px; PADDING-LEFT: 1px; PADDING-BOTTOM: 1px; COLOR: black; BORDER-TOP-STYLE: none; PADDING-TOP: 1px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: transparent; BORDER-BOTTOM-STYLE: none"
selectedstyle-csstext="background-color:#316ac5;border-bottom-color:#999999;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#999999;border-left-style:solid;border-left-width:1px;border-right-color:#999999;border-right-style:solid;border-right-width:1px;border-top-color:#999999;border-top-style:solid;border-top-width:1px;color:White;padding-bottom:0px;padding-left:0px;padding-right:0px;padding-top:0px;">
</eo:treenode>
</looknodes>
<topgroup style-csstext="border-bottom-color:#999999;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#999999;border-left-style:solid;border-left-width:1px;border-right-color:#999999;border-right-style:solid;border-right-width:1px;border-top-color:#999999;border-top-style:solid;border-top-width:1px;color:black;cursor:hand;font-family:Tahoma;font-size:8pt;padding-bottom:2px;padding-left:2px;padding-right:2px;padding-top:2px;">
<nodes>
<eo:treenode imageurl="00030303" populateondemand="True" text="Press Me">
</eo:treenode>
</nodes>
</topgroup>
</eo:treeview>
</eo:callbackpanel>
</form>
</body>
</html>


using System;
using System.Data;
using System.Configuration;
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 partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("tr-TR");
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("tr-TR");
}
protected void TreeView1_ItemPopulate(object sender, EO.Web.NavigationItemEventArgs e)
{
EO.Web.TreeNode node = new EO.Web.TreeNode();
node.Text = "test";
node.PopulateOnDemand = true;
e.TreeNode.ChildNodes.Add(node);
}
}
eo_support
Posted: Tuesday, September 11, 2007 4:55:22 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi Ilan,

AJAX solution only works with utf-8. You can not use any other type --- you will get view state error if you do. This is not just our CallbackPanel. ASP.NET AJAX also does that.

Thanks
Jhon s
Posted: Tuesday, September 11, 2007 6:27:04 AM
Rank: Advanced Member
Groups: Member

Joined: 5/31/2007
Posts: 36
but it only started to happen after using the populate on demand feature
i've never had any problem with that before
Jhon s
Posted: Tuesday, September 11, 2007 6:35:55 AM
Rank: Advanced Member
Groups: Member

Joined: 5/31/2007
Posts: 36
ok, i've tested it with Atlas ajax and windows deafult tree view
and the its ok every time i hit postback,
it looks like a problem with your callback

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:updatepanel id="UpdatePanel1" runat="server">
<contenttemplate>
<asp:treeview id="TreeView1" runat="server" imageset="Contacts" nodeindent="10">
<parentnodestyle font-bold="True" forecolor="#5555DD" />
<hovernodestyle font-underline="False" />
<selectednodestyle font-underline="True" horizontalpadding="0px" verticalpadding="0px" />
<nodes>
<asp:treenode text="New Node" value="New Node">
<asp:treenode text="New Node" value="New Node"></asp:treenode>
</asp:treenode>
<asp:treenode text="New Node" value="New Node">
<asp:treenode text="New Node" value="New Node"></asp:treenode>
</asp:treenode>
<asp:treenode text="New Node" value="New Node"></asp:treenode>
<asp:treenode text="New Node" value="New Node"></asp:treenode>
</nodes>
<nodestyle font-names="Verdana" font-size="8pt" forecolor="Black" horizontalpadding="5px"
nodespacing="0px" verticalpadding="0px" />
</asp:treeview>
<asp:button id="Button1" runat="server" text="Button" />
</contenttemplate>
<triggers>
<asp:asyncpostbacktrigger controlid="Button1" />
</triggers>
</asp:updatepanel>

</form>
</body>
</html>



using System;
using System.Data;
using System.Configuration;
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 partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("tr-TR");
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("tr-TR");
}
}
eo_support
Posted: Tuesday, September 11, 2007 6:48:03 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
You didn't run into it doesn't mean it doesn't exist. :)

http://forums.asp.net/p/1020399/1898704.aspx

Populating on demand and view state themselves are tricky issues when they are put together. Generally view state should not be used when using populating on demand because the purpose of populating on demand is for loading large TreeView node by node without going back to the server. For this reason the dynamically populated nodes are not stored in the view state. We however do log calls to ItemPopulate event and "reply" them. So there might be some indirect connection on that but as a general rule, AJAX solution should use UTF-8, or you can get into some really strange error.

Thanks
Jhon s
Posted: Tuesday, September 11, 2007 7:03:48 AM
Rank: Advanced Member
Groups: Member

Joined: 5/31/2007
Posts: 36
has for populating on demand issue, i have another example with much simple code

just put a button inside a callack and trigger the callback
i get the error (persist view state=true)

now when using atlas callback it works ok

it seems like microsoft solved this??



Jhon s
Posted: Tuesday, September 11, 2007 7:06:48 AM
Rank: Advanced Member
Groups: Member

Joined: 5/31/2007
Posts: 36
also i have the <globalization requestEncoding="UTF-8" responseEncoding="UTF-8"></globalization> configured in my web.config
eo_support
Posted: Tuesday, September 11, 2007 7:38:01 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Sign...if you refuse to believe us then I am not sure whether we can help you much further. ASP.NET AJAX was released this January and there has been no official release after that. UTF-8 is a browser restriction related to browser's implementation of encodeURIComponent and it doesn't really have too much to do with anything else. It's possible to override that function but there are severe side effects.

ASP.NET AJAX has the same problem ---- but it may manifest under different scenarios, it generally does not throw out an error, but it gives you wrong contents for your textbox in the page. To see the error, try change encoding in your web.config, put a TextBox in an UpdatePanel, then type in some characters other than standard ASCII characters (many extended Europe characters, such as Russian characters will do), trigger the UpdatePanel and put a breakpoint on the server side you will see TextBox1.Text shows you garbage data.

Come back to your code, the only thing you need to do is to remove the code in your Page_Load that set the CurrentCulture, and make sure you have UTF-8 in your web.config and the code should work fine.

The issue is now closed. If you still believe ASP.NET AJAX can work with other encoding you can certainly go ahead to take the risk.
Jhon s
Posted: Tuesday, September 11, 2007 7:49:30 AM
Rank: Advanced Member
Groups: Member

Joined: 5/31/2007
Posts: 36
you don't have to get upset i believe you.
i've red the aticle and it really seems to be a problem in ajax.
i just wish there where some solution for this, since globaliztion is used on many servers,
maybe add a property to callback settings its culture overiding the page culture (i've seen this in some controls) .
any way i will do some work around,
thanks anyway.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.