asp.net中,关于button的一个菜鸟问题!
我想实现那种点击了提交按钮后,提交按钮就变灰色,不能重复提交的功能。我的代码如下,可运行起来有错,代码如下:ASPX:<%@PageLanguage="C#"AutoEv...
我想实现那种点击了提交按钮后,提交按钮就变灰色,不能重复提交的功能。我的代码如下,可运行起来有错,代码如下:
ASPX:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Buton.aspx.cs" Inherits="Buton" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
onclientclick="javascript:this.disabled=true;this.form1.submit();"
Text="Button" UseSubmitBehavior="False" />
</div>
</form>
</body>
</html>
CS:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class Buton : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Button1.Text = "数据处理中...请稍后!";
Button1.Enabled = false;
}
} 展开
ASPX:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Buton.aspx.cs" Inherits="Buton" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
onclientclick="javascript:this.disabled=true;this.form1.submit();"
Text="Button" UseSubmitBehavior="False" />
</div>
</form>
</body>
</html>
CS:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class Buton : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Button1.Text = "数据处理中...请稍后!";
Button1.Enabled = false;
}
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询