upgraded from 2005 to 2007 vol3. when clicked on menuitem, breaks at targeturl with Microsoft JScript error: syntax error
value of targeturl shows.."ExitCallToLink('Call.aspx',"
where the value that has been passed was.."ExitCallToLink('Call.aspx', '');"
any fixes any ideas...thanks in advance.
forgot node creation code..
Header.ascx.vb
Imports System.IO
Imports System.Xml
Inherits System.Web.UI.UserControl
Private section As String
' Output the desired node structure
section = "CallTrack"
g_oTreeViewNav.Load(Server.MapPath("WebNav.xml"))
Dim strXPath As String = "Navigation/LeftNav/Section[@id='" & section & "']/Nodes"
CreateWebTreeNodes(oSectionNode)
End Sub
Dim oMenuNodes As XmlNodeList = oSectionNode.ChildNodes
For Each oMenuNode In oMenuNodes
' Check to see if the next node has a collection of inner nodes
If oMenuNode.InnerXml.ToString().Trim().Length > 0 Then
' Build a menu item for each node in the list
oNewNode.Text = oMenuNode.Attributes("Text").Value
Dim oInnerNodes As XmlNodeList = oMenuNode.SelectNodes("Nodes/Node")
' Build the nested level of menu items belonging to the outer menu node
For Each oNestedXmlNode In oInnerNodes
oNestedMenuNode.TargetUrl = oNestedXmlNode.Attributes("TargetUrl").Value
oNestedMenuNode.TargetFrame = oNestedXmlNode.Attributes("TargetFrame").Value
' Add the nested menu node to the outer menu node's nodelist
oNewNode.Nodes.Add(oNestedMenuNode)
Next
Else
End If
'Add the outer menu node to the Web Tree object's nodes collection
UltraWebTree1.Nodes.Add(oNewNode)
End Class
ok back to square one. encoding change doesn't work. I was able to recreate the problem in one sample application. hopefully some one can see what's wrong. thanks in advance. here is the code..
.xml file -- webnav.xml
<Navigation>
<Section id="CallTrack">
<Node TargetUrl="BLOCKED SCRIPTExitCallToLink('Call.aspx','');" Text="New Call" TargetFrame="" />
<Node TargetUrl="" Text="-----------------" TargetFrame="" />
<Node TargetUrl="BLOCKED SCRIPTExitCallToLink('ReferList.aspx', '');" Text="Referral List" TargetFrame="" />
<Node TargetUrl="BLOCKED SCRIPTExitCallToLink('History.aspx', '');" Text="Time Summary" TargetFrame="" />
<Node TargetUrl="BLOCKED SCRIPTExitCallToLink('Reports.aspx', '');" Text="Reports" TargetFrame="" />
<Node TargetUrl="BLOCKED SCRIPTExitCallToLink('Index.aspx', '');" Text="Home" TargetFrame="" />
</Section>
</Navigation>
function call is in supportcontrol.js file..
{
alert(param1);
window.location.href = param1;
}
header.ascx control ---
<%@ Register Assembly="Infragistics2.WebUI.UltraWebNavigator.v7.3, Version=7.3.20073.1043, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
Namespace="Infragistics.WebUI.UltraWebNavigator" TagPrefix="ignav" %>
<div id="Header">
<ignav:UltraWebTree ID="UltraWebTree1" runat="server" DefaultImage="" HiliteClass="" HoverClass="" Indentation="20" FileUrl="WebNav.xml">
<Levels>
<ignav:Level Index="0" />
</Levels>
</div>
Default.aspx -- that calls Header control---
<%@ Register Src="Header.ascx" TagName="Header" TagPrefix="uc1" %>
<head runat="server">
<title>Test UltraWebTree</title>
<script type="text/javascript" language="javascript" src="SupportControl.js"></script>
<body>
<form id="form1" runat="server">
<uc1:Header ID="Header1" runat="server" />
</body>
</html>
the first node seems to be working..all the other nodes end up in an error.
any help will be appreciated. thanks.
thank u all for the responses. I tried the xml file with sample application and it works and my main solution didn't work with the same code. I was checking other xml files in my project, and the only difference I found was encoding= windows-1258 in the menu xml file and all the other files are having encoding = utf-8. so, I changed encoding to utf-8 for my menu xml file and it works. kind of wierd, but that't the only change I made.
thank u all for ur help, really appreciate it.
Really weird, but I still cannot reproduce the problem in my test projects. Using your XML file, here is my code
<form id="form1" runat="server"> <script type="text/javascript"> function ExitCallToLink(param1, param2) { window.location.href = param1; } </script> <ignav:UltraWebTree ID="UltraWebTree1" runat="server"> </ignav:UltraWebTree> </form>
Protected Sub OnLoad(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load 'MyBase.OnLoad(e) Dim xmlDoc As XmlDocument = New XmlDocument() xmlDoc.Load(Server.MapPath("XmlFile2.xml")) Dim strXPath As String = "Navigation/Header/Section[@id='CallTrack']/Nodes" Dim oSectionNode As XmlNode = xmlDoc.SelectSingleNode(strXPath) Dim oMenuNodes As XmlNodeList = oSectionNode.ChildNodes Dim oMenuNode As XmlNode For Each oMenuNode In oMenuNodes Dim oNewNode As New Infragistics.WebUI.UltraWebNavigator.Node ' Check to see if the next node has a collection of inner nodes 'If oMenuNode.InnerXml.ToString().Trim().Length > 0 Then ' Build a menu item for each node in the list oNewNode.TargetUrl = oMenuNode.Attributes("TargetUrl").Value oNewNode.Text = "Some Text" UltraWebTree1.Nodes.Add(oNewNode) 'End If Next End Sub
Everything works great at my side....
If we cannot make any progress, I can suggest contacting support and sending them a small subset of your project reproducing the problem.
It looks like the string you're putting in your XML file needs to escape/encode some characters (like the quotes). You can either use an XML Writer to create your xml, or you'll need to use the HTMLEncode method before assigning the attribute value for your XML document.