pagelet问题,答者有分 给它的Click事件绑定一个处理程序,那所这个程序什么也不做,该页也会被回发。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 to webdiyer(webdiyer)曾经能刷新,但现在不行了 正好我做了一个login的pagelet页面文件<%@ Control Language="c#" AutoEventWireup="false" Codebehind="Login.ascx.cs" Inherits="corun.Controls.Login" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%><p align="center"><asp:Label id="Lab_CopyRight" runat="server">版权所有© 2001 广州市百成科技有限公司</asp:Label></p><p align="center"> <asp:panel id="PHLogined" Runat="server" Visible="False">工号 <asp:TextBox id="tb_UserName" Runat="server" BackColor="Control" BorderWidth="1px" Height="20px" Width="40"></asp:TextBox>密码 <asp:TextBox id="tb_Password" Runat="server" BackColor="Control" BorderWidth="1px" Height="20px" Width="40" TextMode="Password"></asp:TextBox><asp:Button id="btn_Login" Runat="server" BorderWidth="1px" Height="20px" Width="40px" text="登录"></asp:Button></asp:panel> <asp:panel id="PHLogin" Runat="server" Visible="False">姓名 <asp:Label id="lab_UserName" Runat="server"></asp:Label>部门 <asp:Label id="lab_Depart" Runat="server"></asp:Label>用户群组 <asp:Label id="Lab_Group" Runat="server"></asp:Label><asp:Button id="btn_Logout" BorderWidth="1px" Height="20px" Width="40px" Text="退出" runat="server"></asp:Button> </asp:panel></p><p align="center"><a href="mailto:[email protected]">mailto:[email protected]</a></p>代码文件namespace corun.Controls{ using System; using System.Data; using System.Drawing; using System.Web; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; /// <summary> /// Login 的摘要说明。 /// </summary> public abstract class Login : System.Web.UI.UserControl { protected System.Web.UI.WebControls.TextBox tb_UserName; protected System.Web.UI.WebControls.TextBox tb_Password; protected System.Web.UI.WebControls.Panel PHLogined; protected System.Web.UI.WebControls.Label lab_UserName; protected System.Web.UI.WebControls.Label lab_Depart; protected System.Web.UI.WebControls.Label Lab_Group; protected System.Web.UI.WebControls.Button btn_Login; protected System.Web.UI.WebControls.Button btn_Logout; protected System.Web.UI.WebControls.Label Lab_CopyRight; protected System.Web.UI.WebControls.Panel PHLogin; private void InitUserInfo(){ try { //如果Session["UserInfo为空或不是对象"]认为没有登录 if(Session["UserInfo"] is corun.CorunClass.BaseUserInfo) { this.PHLogined.Visible=false; this.PHLogin.Visible=true; corun.CorunClass.BaseUserInfo UInfo=(corun.CorunClass.BaseUserInfo)Session["UserInfo"]; this.lab_Depart.Text=UInfo.strDepartName; this.Lab_Group.Text=UInfo.strGroupName; this.lab_UserName.Text =UInfo.strUserName; } else { this.PHLogined.Visible=true; this.PHLogin.Visible=false; } } catch(System.Exception excep){ Response.Write (corun.CorunClass.Validate.jsAlert(excep.Message)); } } private void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 if(!Page.IsPostBack){InitUserInfo();} } #region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。 // InitializeComponent(); base.OnInit(e); } /// 设计器支持所需的方法 - 不要使用 /// 代码编辑器修改此方法的内容。 /// </summary> private void InitializeComponent() { this.btn_Login.Click += new System.EventHandler(this.btn_Login_Click); this.btn_Logout.Click += new System.EventHandler(this.btn_Logout_Click); this.Load += new System.EventHandler(this.Page_Load); } #endregion private void btn_Logout_Click(object sender, System.EventArgs e) { Session["UserInfo"]=null; this.InitUserInfo(); //Response.Redirect(System.Configuration.ConfigurationSettings.AppSettings["BaseURL"].ToString()+"Login.aspx",true); } private void btn_Login_Click(object sender, System.EventArgs e) { try{ string strUserName=this.tb_UserName.Text.Trim(); string strPassword=this.tb_Password.Text.Trim(); Session["UserInfo"]=corun.CorunClass.UserInfo.UserLogin(strUserName,strPassword); this.InitUserInfo(); } catch(System.Exception excep){ Response.Write(corun.CorunClass.Validate.jsAlert(excep.Message)); } } }} IIS7 允许PUT操作在哪设置? vs2005中response的close方法不兼容chrome浏览器?如何解决? 用JS写的.net项目,在IIS7.5下put请求报错,求解决方法。 一个服务器和系统时间的比较,本人新手,希望高手帮忙解答下 未将对象引用设置到对象的实例。 求一条正则表达式 请教插入时触发器问题 如何用程序控制EXCEL的格式?高手来帮忙!!! 关于Panel中哪些动态生成的CheckBox被选中的问题 请问各位高手,如何保存文本框中包含HTML代码的文本 关于OWC中Spreadsheet控件的性能问题 怎样设置DropDownList选定的项?
曾经能刷新,但现在不行了
页面文件
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="Login.ascx.cs" Inherits="corun.Controls.Login" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<p align="center"><asp:Label id="Lab_CopyRight" runat="server">版权所有© 2001 广州市百成科技有限公司</asp:Label></p>
<p align="center">
<asp:panel id="PHLogined" Runat="server" Visible="False">工号
<asp:TextBox id="tb_UserName" Runat="server" BackColor="Control" BorderWidth="1px" Height="20px" Width="40"></asp:TextBox>密码
<asp:TextBox id="tb_Password" Runat="server" BackColor="Control" BorderWidth="1px" Height="20px" Width="40" TextMode="Password"></asp:TextBox>
<asp:Button id="btn_Login" Runat="server" BorderWidth="1px" Height="20px" Width="40px" text="登录"></asp:Button></asp:panel>
<asp:panel id="PHLogin" Runat="server" Visible="False">姓名
<asp:Label id="lab_UserName" Runat="server"></asp:Label>部门
<asp:Label id="lab_Depart" Runat="server"></asp:Label>用户群组
<asp:Label id="Lab_Group" Runat="server"></asp:Label>
<asp:Button id="btn_Logout" BorderWidth="1px" Height="20px" Width="40px" Text="退出" runat="server"></asp:Button>
</asp:panel>
</p>
<p align="center"><a href="mailto:[email protected]">mailto:[email protected]</a></p>代码文件
namespace corun.Controls
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls; /// <summary>
/// Login 的摘要说明。
/// </summary>
public abstract class Login : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.TextBox tb_UserName;
protected System.Web.UI.WebControls.TextBox tb_Password;
protected System.Web.UI.WebControls.Panel PHLogined;
protected System.Web.UI.WebControls.Label lab_UserName;
protected System.Web.UI.WebControls.Label lab_Depart;
protected System.Web.UI.WebControls.Label Lab_Group;
protected System.Web.UI.WebControls.Button btn_Login;
protected System.Web.UI.WebControls.Button btn_Logout;
protected System.Web.UI.WebControls.Label Lab_CopyRight;
protected System.Web.UI.WebControls.Panel PHLogin; private void InitUserInfo(){
try
{
//如果Session["UserInfo为空或不是对象"]认为没有登录
if(Session["UserInfo"] is corun.CorunClass.BaseUserInfo)
{
this.PHLogined.Visible=false;
this.PHLogin.Visible=true;
corun.CorunClass.BaseUserInfo UInfo=(corun.CorunClass.BaseUserInfo)Session["UserInfo"];
this.lab_Depart.Text=UInfo.strDepartName;
this.Lab_Group.Text=UInfo.strGroupName;
this.lab_UserName.Text =UInfo.strUserName;
}
else
{
this.PHLogined.Visible=true;
this.PHLogin.Visible=false;
}
}
catch(System.Exception excep){
Response.Write (corun.CorunClass.Validate.jsAlert(excep.Message));
}
}
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!Page.IsPostBack){InitUserInfo();}
} #region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// 设计器支持所需的方法 - 不要使用
/// 代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btn_Login.Click += new System.EventHandler(this.btn_Login_Click);
this.btn_Logout.Click += new System.EventHandler(this.btn_Logout_Click);
this.Load += new System.EventHandler(this.Page_Load); }
#endregion
private void btn_Logout_Click(object sender, System.EventArgs e)
{
Session["UserInfo"]=null;
this.InitUserInfo();
//Response.Redirect(System.Configuration.ConfigurationSettings.AppSettings["BaseURL"].ToString()+"Login.aspx",true);
} private void btn_Login_Click(object sender, System.EventArgs e)
{
try{
string strUserName=this.tb_UserName.Text.Trim();
string strPassword=this.tb_Password.Text.Trim();
Session["UserInfo"]=corun.CorunClass.UserInfo.UserLogin(strUserName,strPassword);
this.InitUserInfo();
}
catch(System.Exception excep){
Response.Write(corun.CorunClass.Validate.jsAlert(excep.Message));
}
}
}
}