C# 改变URL的值,问题。属性里的url就是不改变。气死我了。 20
usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Collections;usingS...
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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)
{
SiteMap.SiteMapResolve += new SiteMapResolveEventHandler(SiteMap_SiteMapresolve);
}
SiteMapNode SiteMap_SiteMapresolve(object sender, SiteMapResolveEventArgs e)
{
SiteMapNode CurrentNode = SiteMapCurrentNode.Clone(true);
SiteMapNode TempNode = CurrentNode ;
int id = nid();
int page = npage();
if (id > 0)
{
TempNode.Url = TempNode.Url + "?id=" + id.ToString();
}
if (id > 0 && page >= 0)
{
TempNode.Url = TempNode.Url + "&page=" + page.ToString();
}
else if (page >= 0)
{
TempNode.Url = TempNode.Url + "?page=" + page.ToString();
}
return TempNode;
}
private int nid()
{
return 12;
}
private int npage()
{
return 3;
}
} 展开
using System.Data;
using System.Configuration;
using System.Collections;
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)
{
SiteMap.SiteMapResolve += new SiteMapResolveEventHandler(SiteMap_SiteMapresolve);
}
SiteMapNode SiteMap_SiteMapresolve(object sender, SiteMapResolveEventArgs e)
{
SiteMapNode CurrentNode = SiteMapCurrentNode.Clone(true);
SiteMapNode TempNode = CurrentNode ;
int id = nid();
int page = npage();
if (id > 0)
{
TempNode.Url = TempNode.Url + "?id=" + id.ToString();
}
if (id > 0 && page >= 0)
{
TempNode.Url = TempNode.Url + "&page=" + page.ToString();
}
else if (page >= 0)
{
TempNode.Url = TempNode.Url + "?page=" + page.ToString();
}
return TempNode;
}
private int nid()
{
return 12;
}
private int npage()
{
return 3;
}
} 展开
1个回答
展开全部
protected void Page_Load(object sender, EventArgs e)
{
SiteMap.SiteMapResolve += new SiteMapResolveEventHandler(SiteMap_SiteMapresolve);
}
改为
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
SiteMap.SiteMapResolve += new SiteMapResolveEventHandler(SiteMap_SiteMapresolve);
}
}
{
SiteMap.SiteMapResolve += new SiteMapResolveEventHandler(SiteMap_SiteMapresolve);
}
改为
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
SiteMap.SiteMapResolve += new SiteMapResolveEventHandler(SiteMap_SiteMapresolve);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询