Welcome Guest Search | Active Topics | Sign In | Register

issue with populate on demand and databind Options
Jhon s
Posted: Monday, October 8, 2007 7:38:07 AM
Rank: Advanced Member
Groups: Member

Joined: 5/31/2007
Posts: 36
hi, i have a tree that im databinding xml with some nodes, all nodes have populate on demand = true since i have more nodes that i want to populate on demand,
now after populating , when clicking on a node i raise a server event , then i get this message



Server Error in '/Website1 Application.


Index and length must refer to a location within the string.
Parameter name: length
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length]
System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) +2819959
System.String.Substring(Int32 startIndex, Int32 length) +11
EO.Web.Internal.StateDataReader.ReadString() +80
EO.Web.Internal.fj.a(String A_0) +415
EO.Web.Internal.fj.a(String A_0) +176
EO.Web.Internal.fj.a(String A_0) +176
EO.Web.Internal.br.a(String A_0) +204
EO.Web.Internal.br.a(String A_0, String A_1) +1047
EO.Web.Internal.br.a(String A_0, String A_1, String A_2) +80
EO.Web.Internal.br.b(String A_0, String A_1) +32
EO.Web.Internal.bu.l() +112
EO.Web.WebControlBase.a(Object A_0) +99
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +377
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +195
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +424
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +195
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +424
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +195
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +424
System.Web.UI.Page.LoadAllState() +559
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2238





Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832






do you have any idea why do i get this message , i will try to create an example reproducing this error, but it will take some .
thanks, ilan.
eo_support
Posted: Monday, October 8, 2007 7:57:11 AM
Rank: Administration
Groups: Administration

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

That could be a bug. We have recently fixed a similar bug internally and should be able to post it this week. By then you can verify whether it has been fixed.

Thanks
Jhon s
Posted: Thursday, October 11, 2007 3:42:29 AM
Rank: Advanced Member
Groups: Member

Joined: 5/31/2007
Posts: 36
hi,
i've downloaded build 42 , the memory leak is now fixed and looks good but the issue with the error posted here still happnes,
i think popluate on demand and clientsideafteritemclick dosn't work well togever

<%@ page language="VB" autoeventwireup="false" codefile="Default.aspx.vb" 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>
<script type="text/javascript">
function tree_event(e,eventInfo) {
eo_Callback("CallbackPanel1",eventInfo.getItem().getValue());

}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<eo:callbackpanel id="CallbackPanel1" loadingdialogid="Dialog1" runat="server">
<eo:treeview id="TreeView1" runat="server" clientsideonitemclick="tree_event" >
<looknodes>
<eo:treenode itemid="_Default">
</eo:treenode>
</looknodes>
<topgroup>
<nodes>
<eo:treenode populateondemand="True" text="New Tree Node">
</eo:treenode>
</nodes>
</topgroup>
</eo:treeview>
</eo:callbackpanel>
</div>
</form>
</body>
</html>



Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub TreeView1_ItemPopulate(ByVal sender As Object, ByVal e As EO.Web.NavigationItemEventArgs) Handles TreeView1.ItemPopulate
Dim node As New EO.Web.TreeNode
node.Text = "New Node Opened"
node.PopulateOnDemand = True
e.TreeNode.ChildNodes.Add(node)
End Sub

Protected Sub CallbackPanel1_Execute(ByVal sender As Object, ByVal e As EO.Web.CallbackEventArgs) Handles CallbackPanel1.Execute

End Sub


End Class
Jhon s
Posted: Thursday, October 11, 2007 5:35:15 AM
Rank: Advanced Member
Groups: Member

Joined: 5/31/2007
Posts: 36
hi again, what i posted earlier isn't quite the error i wanted to show.
after lots of testing i finally managed to reporoduced the right error

take a look at the code below aand the itemid "TRACK2/0806T000004ISL1_work"
it seems that when the length of the itemid = 27 it thrwos this error.
any other length (26,28) less or more it works ok.

after trigerring callback thats when i get the exeption i've posted here

<%@ page language="VB" autoeventwireup="false" codefile="Default.aspx.vb" 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>
<script type="text/javascript">

function saveState(mode){
eo_Callback("CallbackPanel1",mode);
}


</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="button" value="submit" onclick="saveState('trigger');" />
<eo:callbackpanel id="CallbackPanel1" runat="server" loadingdialogid="Dialog_Refresh" >
<asp:hiddenfield id="HiddenField_TrackingMode" value="" runat="server" />
<eo:treeview id="TreeView1" datasourceid="XmlDataSource1" runat="server" autocheckchildren="True"
autocheckparent="True" autouncheckchildren="True" pathseparator=";" loadinglookid="loading_look"
autoscroll="False">
<looknodes>
<eo:treenode 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;"
hoverstyle-csstext="background-color:transparent;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;color:black;padding-bottom:1px;padding-left:1px;padding-right:1px;padding-top:1px;"
imageurl="" itemid="_Default" normalstyle-csstext="background-color:transparent;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;color:black;padding-bottom:1px;padding-left:1px;padding-right:1px;padding-top:1px;text-decoration:underline;"
selectedhoverstyle-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;"
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>
<eo:treenode collapsedimageurl="~/images/loading.gif" expandedimageurl="~/images/loading.gif"
imageurl="~/images/loading.gif" itemid="loading_look" text="Please wait...">
<subgroup showcheckbox="False">
</subgroup>
</eo:treenode>
</looknodes>
<topgroup style-csstext="border-bottom-style:solid;border-bottom-width:0px;border-left-style:solid;border-left-width:0px;border-right-style:solid;border-right-width:0px;border-top-style:solid;border-top-width:0px;color:black;cursor:hand;font-family:Tahoma;font-size:8pt;padding-bottom:2px;padding-left:2px;padding-right:2px;padding-top:2px;">
<bindings>
<eo:databinding datafield="@imageurl" property="ImageUrl" />
<eo:databinding datafield="@value" property="Value" />
<eo:databinding datafield="@onclick" property="OnClickScript" />
<eo:databinding datafield="@itemid" property="ItemID" />
<eo:databinding datafield="@tooltip" property="Tooltip" />
<eo:databinding datafield="@expanded" property="Expanded" />
<eo:databinding datafield="@selected" property="Selected" />
<eo:databinding datafield="@checked" property="CheckState" />
</bindings>
</topgroup>
<lineimages plusminusonly="True" />
</eo:treeview>
<asp:xmldatasource id="XmlDataSource1" runat="server" enablecaching="true" xpath="/*/*">
</asp:xmldatasource>
</eo:callbackpanel>
<eo:dialog runat="server" id="Dialog_Refresh" backshadecolor="Blue">
<contenttemplate>
<table border="0" cellpadding="3" cellspacing="0" style="height: 80px; background-color: White;
border: solid 1px black;" width="150px">
<tr>
<td align="center">
<img src="images/loading.gif" alt="" />
</td>
</tr>
<tr>
<td>
<span id="loadingText" class="menu" style="white-space: nowrap;"></span>
</td>
</tr>
</table>
</contenttemplate>
</eo:dialog>

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




Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
System.Threading.Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo("en-US")
System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("en-US")
End Sub

Protected Sub XmlDataSource1_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles XmlDataSource1.Init
XmlDataSource1.Data = "<xml><Customer value=""Customer"" itemid=""TRACK2/0806T000004ISL1"" title=""TrackTec On 139"" imageurl=""images/ic_reports_small.gif"" expanded=""false"" checked=""Unchecked"" selected=""false"" populateondemand=""true"" customerid=""TRACK2/0806T000004ISL1"" customername=""TrackTec On 139"" /></xml>"
End Sub

Protected Sub TreeView1_ItemDataBound(ByVal sender As Object, ByVal e As EO.Web.NavigationItemEventArgs) Handles TreeView1.ItemDataBound
e.TreeNode.PopulateOnDemand = True
e.TreeNode.ShowCheckBox = EO.Web.NullableBool.True
End Sub

Protected Sub TreeView1_ItemPopulate(ByVal sender As Object, ByVal e As EO.Web.NavigationItemEventArgs) Handles TreeView1.ItemPopulate
Try


If e.TreeNode.Value = "Customer" Then
Dim node As New EO.Web.TreeNode
node.Value = "Group"
node.ItemID = "TRACK2/0806T000004ISL1_work"

node.Text = "Some Name"

node.PopulateOnDemand = True
e.TreeNode.ChildNodes.Add(node)
End If
If e.TreeNode.Value = "Group" Then


Dim node As New EO.Web.TreeNode
node.Value = "Group"
node.ItemID = "Some_Node" 'row("GroupName") 'CustomerID & "_" & row("GroupName")
node.Text = "Some Node" 'row("GroupName")
e.TreeNode.ChildNodes.Add(node)
End If
Catch ex As Exception

End Try

End Sub







End Class
eo_support
Posted: Thursday, October 11, 2007 7:56:26 AM
Rank: Administration
Groups: Administration

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

We've sent a private message to you with the download location of a new build. That build should fix this issue.

Thanks!
Jhon s
Posted: Sunday, October 14, 2007 7:09:59 AM
Rank: Advanced Member
Groups: Member

Joined: 5/31/2007
Posts: 36
hi,
there is no expcetion now but it seems that there is a problem in the view state, the node keeps getting disapeer after callback
eo_support
Posted: Sunday, October 14, 2007 7:39:51 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
You must have disabled ItemPopulate event on postback. You should not to. We've explained the details in our reply to your other post:

http://www.essentialobjects.com/Forum/Default.aspx?g=posts&t=589

Thanks
Jhon s
Posted: Sunday, October 14, 2007 2:47:42 PM
Rank: Advanced Member
Groups: Member

Joined: 5/31/2007
Posts: 36
i'm afraid it only happens if the itemid is 27 characters long
otherwise it works ok
eo_support
Posted: Sunday, October 14, 2007 2:59:36 PM
Rank: Administration
Groups: Administration

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

We have tried the latest build (.43) with the code that you posted in this thread and everything works fine. Please verify whether that works for you, if not, please create a reproducing project with detailed steps about the error and send it to us. Once we have that, we will be happy to look into it.

Thanks


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.