日期:2014-05-19  浏览次数:20417 次

[是按钮事件丢失了吗?]ЮΨ,请大家看哈哈撒 ,在线等哈!
public   partial   class   WEB_login   :   System.Web.UI.Page
{
        protected   void   Page_Load(object   sender,   EventArgs   e)
        {
                Label1.Visible   =   false;
        }
        public   override   void   VerifyRenderingInServerForm(Control   control)
        {
                //base.VerifyRenderingInServerForm(control);
        }
        protected   void   Button1_Click(object   sender,   EventArgs   e)
        {
                Label1.Visible   =   true;
                Label1.Text   =   "这个按钮不起作用呀! ";
        }
}
为什么我写了这段代码   ,在运行的时候按了按钮后,他不反应,...........?

------解决方案--------------------
protected void Button1_Click(object sender, EventArgs e)
{

//这里尝试其他代码?
}
------解决方案--------------------
vs2005中一般事件不会丢失. 看看aspx中有没有Button1_Click的事件定义.
------解决方案--------------------
<asp:Button ID= "Button1 " runat= "server " OnClick= "Button1_Click " 看看onclick在不在.
------解决方案--------------------
不会丢失,每次点按钮都刷新页面,调用Page_Load
------解决方案--------------------
你的button中根本就没有onlick事件.
------解决方案--------------------
button就没有事件,得加上OnClick
<%@ Page Language= "C# " MasterPageFile= "~/WEB/QiTaYe.master " AutoEventWireup= "true " CodeFile= "login.aspx.cs " Inherits= "WEB_login " Title= "Untitled Page " %>
<asp:Content ID= "Content1 " ContentPlaceHolderID= "ContentPlaceHolder1 " Runat= "Server ">
&nbsp; <asp:Button ID= "Button1 " runat= "server " Style= "position: relative "
Text= "Button " />
<asp:Label ID= "Label1 " runat= "server " Style= "position: relative " Width= "104px " OnClick= "Button1_Click "> </asp:Label>

</asp:Content>
------解决方案--------------------
你的那行代码 Label1.Visible = false;可以不在Page_Load中写的啊.你可以在Label1的属性中设计啊