如果有一个控件用在不同页面中,且控件中都有一个链接用于传递参数给该控件,那么这时如在链接中指定页面名就显得很死了。
所以遇到这种情况,最好用系统函数来调用当前页面的文件名
这儿有一个方法可以实现
using System.Web;
string thisPage;
thisPage = HttpContext.Current.Request.Url.Segments[HttpContext.Current.Request.Url.Segments.Length - 1 ];
然后将 thisPage 代入链接处,后面加“?params=value”就可以了
所以遇到这种情况,最好用系统函数来调用当前页面的文件名
这儿有一个方法可以实现
using System.Web;
string thisPage;
thisPage = HttpContext.Current.Request.Url.Segments[HttpContext.Current.Request.Url.Segments.Length - 1 ];
然后将 thisPage 代入链接处,后面加“?params=value”就可以了
回复Comments
作者:
{commentrecontent}