ASP.NETÖзÀÖ¹Ò³Ãæ¶à´ÎÌá½»µÄ´úÂëʵÏÖ
1.
´Ë´¦ÌṩµÄ´úÂëÓÃÀ´ÊµÏÖµ±asp.net
Ò³ÃæÖеÄij¸öButton
±»µã»÷ºódisable
µô¸ÃÒ³ÃæÖÐËùÓеÄButton
£¬´Ó¶ø·ÀÖ¹Ìá½»ÑÓʱµ¼ÖµĶà´ÎÌá½»¡£»ùÓÚ֮ǰµÄonceclickbutton
½Å±¾.
//ASP.NET
ÖзÀÖ¹Ò³Ãæ¶à´ÎÌá½»µÄ´úÂë:javascript< script
language="javascript"> < !-- function disableOtherSubmit() {
var obj = event.srcElement;
var objs = document.getElementsByTagName('INPUT');
for(var i=0; i< objs.length; i++)
{
if(objs[i].type.toLowerCase() == 'submit')
{
objs[i].disabled = true;
}
}
} //--> < /script>//ASP.NET
ÖзÀÖ¹Ò³Ãæ¶à´ÎÌá½»µÄ´úÂë:asp.netpublic
class PreventMultiClick : System.Web.UI.Page {
protected System.Web.UI.WebControls.Button Button1; protected
System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.LinkButton LinkButton1; protected
System.Web.UI.WebControls.Button Button3; private void Page_Load(object sender,
System.EventArgs e)
{
this.GetPostBackEventReference(this.Button3);
//
±£Ö¤ __doPostBack(eventTarget, eventArgument)
ÕýÈ·×¢²á if(!IsPostBack)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("if (typeof(Page_ClientValidate) == 'function')
{
if (Page_ClientValidate() == false)
{
return false;
}
}"); //
±£Ö¤ÑéÖ¤º¯ÊýµÄÖ´ÐÐ
sb.Append("if(window.confirm('are you sure?')==false) return false;
");
//
×Ô¶¨Òå¿Í»§¶Ë½Å±¾ sb.Append("disableOtherSubmit();
");
// disable
ËùÓÐsubmit
°´Å¥
sb.Append(this.GetPostBackEventReference(this.Button3));
//
ÓÃ__doPostBack
À´Ìá½»£¬±£Ö¤°´Å¥µÄ·þÎñÆ÷¶Ëclick
ʼþÖ´ÐÐ sb.Append("; ");
Button3.Attributes.Add("onclick",sb.ToString());
}
} #region Web Form Designer generated code override protected void
OnInit(EventArgs e)
{
// // CODEGEN: This call is required by the ASP.NET Web Form Designer. //
InitializeComponent();
base.OnInit(e);
}
/// < summary> /// Required method for Designer support - do not modify
/
Ïà¹ØÎĵµ£º
×î½üд³ÌÐòÒ»Ö±³öÎÊÌ⣬ÒÔÇ°Ò»¸öÕ¾Èý¼¸Ìì¾ÍÇáËɸ㶨£¬ÏÖÔÚÒ»¸öÄ£¿é¾³£¸ã°ëÌ죬NND
ÏÂÎ翪·¢¿áÒ×»¯×±Æ·É̳Ç(http://www.koyee.net)Ò»¸ö±íµ¥Ìá½»¹¦ÄÜÄ£¿é£¬±¾µØÈκÎÎÊÌⶼûÓÐÁË£¬´«µ½·þÎñÆ÷Éϱ¾ÒÔΪûÊÂÁË£¬ºóÀ´Ò»¼ì²éËùÓеÄÑéÖ¤¿Ø¼þ¶¼²»Æð×÷ÓÃÁË£¬Ö±½Ó¶¼Ìá½»¹ýÈ¥ÁË£¬ÓôÃÆ£¬ÔÒÔΪ³ÌÐò±»¸Ä´íÁË£¬¼ì²é±¾µØ»¹ÊÇûÈκÎÎÊÌ⣬¼ ......
Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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">
< ......
ASP.NET»ñÈ¡¿Í»§¶ËÐÅÏ¢,ÔÝʱ¾ÍÕ⼸¸ö,ÓдýÌí¼Ó~~
1. ÔÚASP.NETÖÐרÓÃÊôÐÔ£º
»ñÈ¡·þÎñÆ÷µçÄÔÃû£ºPage.Server.ManchineName
»ñÈ¡Óû§ÐÅÏ¢£ºPage.User
»ñÈ¡¿Í»§¶ËµçÄÔÃû£ºPage.Request.UserHostName
»ñÈ¡¿Í»§¶ËµçÄÔIP£ºPage.Request.UserHostAddress
2. ÔÚÍøÂç±à³ÌÖеÄͨÓ÷½·¨£º
»ñÈ¡µ±Ç°µçÄÔÃû£ºstatic System. ......
ÔÚAsp.netÖÐʵÏÖÎļþµÄÉÏ´«¹¦ÄÜ£¬ÊǷdz£¼òµ¥µÄÒ»¼þÊÂÇ飬ֻÐèÒªÀûÓÃ΢ÈíÌṩµÄFileUpload¿Ø¼þ¼´¿ÉÇáËÉʵÏÖ¡£
LargeFileUpload.aspx´úÂëÈçÏÂ
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="LargeFileUpload.aspx.vb"
Inherits="LargeFileUpload" %>
<!DOCTYPE html PUBLIC "-//W3C/ ......
±¾ÈË¿ª·¢ASP.NETÒÑÓÐÁ½Äê¶àÁË¡£Ì¸ÆðASP.NETÕæÊÇÈÃÎÒ»¶Ï²ÈÃÎÒÓÇ¡£×òÌìÓÖ³öÏÖÁËÄǸöÆæ¹ÖµÄÎÊÌ⣬¾ÍÊÇÔÚÒ³ÃæÍêȫдºÃºó£¬ÖØÐÂÉú³Éʱ±¨:XXX(Ò³ÃæÃû)²»°üº¬(XXX)µÄ¶¨Òå¡£ÔÚCSÎļþÏÂÊÇ¿ÉÒÔÓà this.xxx д³öÀ´µÄ£¬Ò³ÃæÉÏҲûÎÊÌâ¡£ÔÚ½â¾ö·½°¸ÖÐÖØÐÂÉú³ÉÒ³ÓÖ¿ÉÒÔ£¬ÖØÐÂÉú³ÉÍøÕ¾¾Í»á±¨Õâ¸ö´íÎó¡£½«this.XXX ......