<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="title.aspx" title="根节点" description="">
<siteMapNode url="1111.aspx" title="1111" description="" >
<siteMapNode url="1.aspx" title="1-1" description="" />
<siteMapNode url="2.aspx" title="1-2" description="" />
<siteMapNode url="3.aspx" title="1-3" description="" />
<siteMapNode url="4.aspx" title="1-4" description="" />
</siteMapNode>
<siteMapNode url="2222.aspx" title="2222" description="" >
<siteMapNode url="5.aspx" title="2-1" description="" />
<siteMapNode url="6.aspx" title="2-2" description="" />
<siteMapNode url="7.aspx" title="2-3" description="" />
<siteMapNode url="8.aspx" title="2-4" description="" />
</siteMapNode>
</siteMapNode>
</siteMap>
C#
this.TreeView1.Nodes[0].ChildNodes[0].NavigateUrl = "aa.aspx";索引超出范围。必须为非负值并小于集合大小。
参数名: index
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="title.aspx" title="根节点" description="">
<siteMapNode url="1111.aspx" title="1111" description="" >
<siteMapNode url="1.aspx" title="1-1" description="" />
<siteMapNode url="2.aspx" title="1-2" description="" />
<siteMapNode url="3.aspx" title="1-3" description="" />
<siteMapNode url="4.aspx" title="1-4" description="" />
</siteMapNode>
<siteMapNode url="2222.aspx" title="2222" description="" >
<siteMapNode url="5.aspx" title="2-1" description="" />
<siteMapNode url="6.aspx" title="2-2" description="" />
<siteMapNode url="7.aspx" title="2-3" description="" />
<siteMapNode url="8.aspx" title="2-4" description="" />
</siteMapNode>
</siteMapNode>
</siteMap>
C#
this.TreeView1.Nodes[0].ChildNodes[0].NavigateUrl = "aa.aspx";索引超出范围。必须为非负值并小于集合大小。
参数名: index
解决方案 »
- 首页[上一页] 1 2 3 4 ... 10 11 12 [下一页]尾页
- 理解Application:
- asp.net如何用模板生成静态页面???请教高手指点
- 加密与解密的问题
- 数据库数据混淆的原因???
- 各位老大,这个Error是怎么回事呢?超时时间已到。在操作完成之前超时时间已过或服务器未响应(在线等)
- 连接txt的连接字符串如下,但txt只能放在固定的路径.怎么把通过本地浏览到的文件的路径附给data source 啊??
- 用户提交的问题,快吃饭了,帮忙解决一下吧
- 制作菜单用什么方法制作?
- 菜菜一问:Asp.net 是不是做网页的?
- 请教,BT的面试题!!!!
- 关于ASP.NET项目的“添加引用”问题。
this.TreeView1.Nodes[0].ChildNodes[0].NavigateUrl = "aa.aspx";
就是这条语句出错,出错提示为:
索引超出范围。必须为非负值并小于集合大小。
参数名: index
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.TreeView1.ShowLines = true;
this.LoadXmlTree();
}
} public void LoadXmlTree()
{
xmlDoc = new XmlDocument();
xmlDoc.Load(Server.MapPath("classXml.xml")); XmlNodeList xnl = xmlDoc.SelectSingleNode("school").ChildNodes;
TreeNode tn = new TreeNode();
tn.Text = "school";
tn.Value = "-1";
tn.Expanded = false;
this.TreeView1.Nodes.Add(tn); foreach (XmlNode xn in xnl)
{
XmlElement xe = (XmlElement)xn;
TreeNode tnC = new TreeNode();
tnC.Text = xe.GetAttribute("name");
tnC.Value = xe.GetAttribute("name");
tnC.NavigateUrl = "";☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
tnC.Expanded = true;
tn.ChildNodes.Add(tnC);
this.TreeNodeBind(xn.ChildNodes,tnC);
}
} public void TreeNodeBind(XmlNodeList xnl,TreeNode tn)
{
foreach (XmlNode xnNext in xnl)
{
XmlElement xe = (XmlElement)xnNext;
TreeNode tnNext = new TreeNode();
tnNext.Text = xe.GetAttribute("id");
tnNext.Value = xe.GetAttribute("sex");
tnNext.Expanded = true;
tn.ChildNodes.Add(tnNext);
this.TreeNodeBind(xnNext.ChildNodes,tnNext);
}
}