页面要继承的页面
namespace zzy.Euser
{
/// <summary>
/// eusercommonage 的摘要说明。
/// </summary>
public partial class eusercommonage : System.Web.UI.Page
{
public string pass;
public string page = "1";
protected void Page_Load(object sender, System.EventArgs e)
{
//if(String.IsNullOrEmpty(SiteCommon.SiteContext.CurrentUser.EuserID))
//{
// Page.RegisterStartupScript("start","<script>javascript:top.location.href='/index.aspx'</script>");
//}
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!IsPostBack)
{
if (String.IsNullOrEmpty(SiteCommon.SiteContext.CurrentUser.EuserID))
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "RedirectUrl", "<script>javascript:parent.location.href='/index.aspx'</script>");
}
if (Request["pageIndex"] != null)
{
string js = string.Format("<script>javascript:__doPostBack('netPage','{0}');</script>", Request["pageIndex"]);
Page.ClientScript.RegisterStartupScript(typeof(string), "ChgPage", js);
}
}
pass = Session.SessionID;
string temp = Request.Url.ToString().Replace(SiteCommon.WebUnits.WebRootUrl, "");
string temp_1 = "";
string temp_2 = "";
if (temp.IndexOf("?") > 0)
{
temp_1 = temp.Substring(temp.IndexOf("?"));
temp_2 = temp.Substring(0, temp.IndexOf("?"));

if (!SiteCommon.WebUnits.SelectText(temp_1))
{

temp_1 = SiteCommon.WebUnits.InputText(temp_1);
temp = temp_2 + temp_1;
Page.RegisterStartupScript("start", "<script>window.location.href='" + temp + "'</script>");
}
else
{
if (Session["EuserList"] != null)
{
System.Collections.ArrayList list = new ArrayList();
list = (System.Collections.ArrayList)Session["EuserList"];
if (Request["qx"] != null)
{
if (Request["qx"].ToString().Equals(Session.SessionID))
{
if (!list.Contains(Request["qx"].ToString()))
{
list.Add(Request.Url.ToString().Replace(SiteCommon.WebUnits.WebRootUrl, ""));
Session["EuserList"] = list;
}
}
}

if (!list.Contains(temp))
{
SiteCommon.SiteContext.CurrentUser.EuserID = null;
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "start", "<script>alert('您没有访问此页面的权限!');javascript:top.location.href='/Errors.aspx';</script>");
}
}
}
}
//this.Request.RawUrl = SiteCommon.WebUnits.InputText(this.Request., 100);
}
Web 窗体设计器生成的代码
}
}
-------------------------------------------------------------------------------------------
Html页面设置 权限和转页保留在该页面
<asp:TemplateColumn HeaderText="编辑">
<HeaderStyle Wrap="False" CssClass="tabtitle" HorizontalAlign="Center"></HeaderStyle>
<ItemStyle Wrap="False" CssClass="tabborder" HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<a href='Editprocess.aspx?id=<%# DataBinder.Eval(Container.DataItem, "ID")%>&qx=<%=pass%>&index=<%=page%>'>编辑</a> </ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="相关评论">
<HeaderStyle Wrap="False" CssClass="tabtitle" HorizontalAlign="Center"></HeaderStyle>
<ItemStyle Wrap="False" CssClass="tabborder" HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<a href='processComment.aspx?id=<%# DataBinder.Eval(Container.DataItem, "ID")%>&qx=<%=pass%>&index=<%=page%>'>评论</a> </ItemTemplate>
</asp:TemplateColumn>
-------------------------------------------------------------------------------------------------
分页控件分页事件加入了 该句

private void netPage_PageChanged(object src, Wuqi.Webdiyer.PageChangedEventArgs e)
{
netPage.CurrentPageIndex = e.NewPageIndex;
page = netPage.CurrentPageIndex.ToString();
Bind();
}
//该句为新加入的 使页面分页后保留在该页面分页
page = netPage.CurrentPageIndex.ToString();
namespace zzy.Euser
{
/// <summary>
/// eusercommonage 的摘要说明。
/// </summary>
public partial class eusercommonage : System.Web.UI.Page
{
public string pass;
public string page = "1";
protected void Page_Load(object sender, System.EventArgs e)
{
//if(String.IsNullOrEmpty(SiteCommon.SiteContext.CurrentUser.EuserID))
//{
// Page.RegisterStartupScript("start","<script>javascript:top.location.href='/index.aspx'</script>");
//}
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!IsPostBack)
{
if (String.IsNullOrEmpty(SiteCommon.SiteContext.CurrentUser.EuserID))
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "RedirectUrl", "<script>javascript:parent.location.href='/index.aspx'</script>");
}
if (Request["pageIndex"] != null)
{
string js = string.Format("<script>javascript:__doPostBack('netPage','{0}');</script>", Request["pageIndex"]);
Page.ClientScript.RegisterStartupScript(typeof(string), "ChgPage", js);
}
}
pass = Session.SessionID;
string temp = Request.Url.ToString().Replace(SiteCommon.WebUnits.WebRootUrl, "");
string temp_1 = "";
string temp_2 = "";
if (temp.IndexOf("?") > 0)
{
temp_1 = temp.Substring(temp.IndexOf("?"));
temp_2 = temp.Substring(0, temp.IndexOf("?"));
if (!SiteCommon.WebUnits.SelectText(temp_1))
{
temp_1 = SiteCommon.WebUnits.InputText(temp_1);
temp = temp_2 + temp_1;
Page.RegisterStartupScript("start", "<script>window.location.href='" + temp + "'</script>");
}
else
{
if (Session["EuserList"] != null)
{
System.Collections.ArrayList list = new ArrayList();
list = (System.Collections.ArrayList)Session["EuserList"];
if (Request["qx"] != null)
{
if (Request["qx"].ToString().Equals(Session.SessionID))
{
if (!list.Contains(Request["qx"].ToString()))
{
list.Add(Request.Url.ToString().Replace(SiteCommon.WebUnits.WebRootUrl, ""));
Session["EuserList"] = list;
}
}
}
if (!list.Contains(temp))
{
SiteCommon.SiteContext.CurrentUser.EuserID = null;
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "start", "<script>alert('您没有访问此页面的权限!');javascript:top.location.href='/Errors.aspx';</script>");
}
}
}
}
//this.Request.RawUrl = SiteCommon.WebUnits.InputText(this.Request., 100);
}
Web 窗体设计器生成的代码
}
} 
-------------------------------------------------------------------------------------------
Html页面设置 权限和转页保留在该页面
<asp:TemplateColumn HeaderText="编辑">
<HeaderStyle Wrap="False" CssClass="tabtitle" HorizontalAlign="Center"></HeaderStyle>
<ItemStyle Wrap="False" CssClass="tabborder" HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<a href='Editprocess.aspx?id=<%# DataBinder.Eval(Container.DataItem, "ID")%>&qx=<%=pass%>&index=<%=page%>'>编辑</a> </ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="相关评论">
<HeaderStyle Wrap="False" CssClass="tabtitle" HorizontalAlign="Center"></HeaderStyle>
<ItemStyle Wrap="False" CssClass="tabborder" HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<a href='processComment.aspx?id=<%# DataBinder.Eval(Container.DataItem, "ID")%>&qx=<%=pass%>&index=<%=page%>'>评论</a> </ItemTemplate>
</asp:TemplateColumn>分页控件分页事件加入了 该句

private void netPage_PageChanged(object src, Wuqi.Webdiyer.PageChangedEventArgs e)
{
netPage.CurrentPageIndex = e.NewPageIndex;
page = netPage.CurrentPageIndex.ToString();
Bind();
}
//该句为新加入的 使页面分页后保留在该页面分页
page = netPage.CurrentPageIndex.ToString();


浙公网安备 33010602011771号