ASP.NETÖÐÔÚµã»÷°´Å¥ºó½«¸Ã°´Å¥ÉèΪ²»¿ÉÓõÄÈô¸ÉÇé¿ö
ÔÎÄ£ºÁõÎä|ASP.NETÖÐÔÚµã»÷°´Å¥ºó½«¸Ã°´Å¥ÉèΪ²»¿ÉÓõÄÈô¸ÉÇé¿ö
ÏîÄ¿Öо³£³öÏÖÓû§Öظ´Ìá½»µÄÇé¿ö£¬ÎªÁË·ÀÖ¹ÕâÖÖÇé¿ö£¬×î³£Óõķ½·¨¾ÍÊÇÔÚÓû§µã»÷°´Å¥ºó½«¸Ã°´Å¥ÉèΪ²»¿ÉÓ㬱ÊÕßÔÚʵ¼Ê¿ª·¢µ±ÖÐÓöµ½Á˶àÖÖ²»Í¬µÄÇé¿ö£¬ÔÚ´Ë×ö¸öС½á£¬ÒÔ¹©²Î¿¼¡£
µÚÒ»ÖÖÇé¿öÊÇ·ÇsubmitÀàÐ͵İ´Å¥
ÕâÖÖÇé¿ö±È½Ï¼òµ¥£¬Ö»ÒªÔÚ¿Í»§¶ËÌí¼Óʼþ£¬½«°´Å¥ÉèΪ²»¿ÉÓþͿÉÒÔÁË¡£¿´ÏÂÃæµÄ´úÂ룺
ASP.NET-Code:
<form id="form1" runat="server">
<asp:Label ID="lbl" runat="server"></asp:Label>
<asp:Button ID="btn" runat="server" Text="Test"
OnClick="btn_Click" OnClientClick="this.disabled=true"
UseSubmitBehavior="false" />
</form>
C#-Code:
protected void btn_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(1000);
lbl.Text = DateTime.Now.ToString();
}
µÚ¶þÖÖÇé¿öÊÇsubmitÀàÐ͵İ´Å¥
´ËʱµÚÒ»ÖÖ·½·¨¾Í²»ÐÐÁË£¬°´Å¥±»ÉèΪDISABLEDÖ®ºó¾ÍÎÞ·¨Íê³ÉÌá½»£¬ÎÒÃÇ¿ÉÒÔÊʵ±Ð޸ĴúÂ룺
ASP.NET-Code:
<form id="form1" runat="server">
<asp:Label ID="lbl" runat="server"></asp:Label>
<asp:Button ID="btn" runat="server" Text="Test"
OnClick="btn_Click"/>
</form>
C#-Code:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
btn.OnClientClick = "this.disabled=true;" +
GetPostBackEventReference(btn);
}
}
ÓëµÚÒ»ÖÖ·½·¨²»Í¬µÄÊÇÎÒÃÇÔÚPage_LoadÖиø°´Å¥Ìí¼Ó¿Í»§¶Ëʼþ£¬²¢¸½¼ÓÁËGetPostBackEventReference¡£µ«ÕâÑù×ö»¹ÓиöȱÏÝ£¬ÔÚµÚÒ»Ìá½»»Ø·¢Íê³ÉÒÔºó£¬ÔÙµã»÷°´Å¥¾Í»áʧ°Ü£¬Òò´ËÎÒÃÇÐèҪȥµôif (!Page.IsPostBack)Õâ¾ä£¬Ò²¾ÍÊÇÿ´Î»Ø·¢¶¼Ò
Ïà¹ØÎĵµ£º
±¾ÌùÀ´×ÔZDNetChinaÖÐÎÄÉçÇø http://bbs.zdnet.com.cn/
±¾ÌùµØÖ·£ºhttp://bbs.zdnet.com.cn/viewthread.php?tid=108315
Èç¹ûÄãÒѾÓн϶àµÄÃæÏò¶ÔÏ󿪷¢¾Ñ飬Ìø¹ýÒÔÏÂÕâÁ½²½£º
¡¡¡¡µÚÒ»²½¡¡ÕÆÎÕÒ»ÃÅ.NETÃæÏò¶ÔÏóÓïÑÔ£¬C#»òVB.NET ÎÒÇ¿ÁÒ·´¶ÔÔÚûϵͳѧ¹ýÒ»ÃÅÃæÏò¶ÔÏó(OO)ÓïÑÔµÄÇ°ÌáÏÂȥѧASP.NET¡£ ASP.NETÊÇ ......
Asp.net ×Ô¶¯·¢ËÍÓʼþµÄ·½·¨
½ñÌìÓÐÒ»¸öÄ£¿éÐèÒª×Ô¶¯·¢ËÍÓʼþµÄ¹¦ÄÜ£¬¾ÍËæ±ãдÁËÒ»¸ö£¬¼Ç¼һÏÂ×÷Ϊ»ýÀÛ¡£
Ò»¡¢Ê×ÏÈÐèÒªÅäÖÃweb.configÎļþ£º
<system.net>
<mailSettings>
<smtp from="Emailname">
<network ho ......
ASP.NET(C#)·µ»ØÉÏÒ»Ò³(ºóÍË)´úÂë
2008-08-10 10:32
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ViewState["BackUrl"] = Request.UrlReferrer.ToString();
}
}
/// <s ......
asp.net ¿ª·¢Öг£ÓõÄһЩ·½·¨×ܽáËäȻдµÄ²»ºÃ,µ«ºÜʵÓÃ
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Net;
using System.Text.RegularExpressions;
using System.Web.UI;
using System.Web.SessionState;
using System.Web.UI.WebControls;
using Syst ......
asp.net¿ª·¢ÖУ¬Í¨³£ÐèÒª×öһЩ¿Í»§¶ËÑéÖ¤¡£µ±ÎÒÃÇĬÈÏÔÚÒ»¸öÒ³ÃæÖмӸöbutton¿Ø¼þʱ£¬Õâ¸öButton±»asp.net Êä³öΪһ¸öSubmit°´Å¥¡£ asp:Button ID=Button1 runat=server Text=Button on click=Button1_Click /
ÔÚ_doPostBack·½·¨ÄÚ£¬Í¨¹ýtheForm.submit()À´Ê¹Êý¾ÝÌá½»µ½·þÎñÆ÷¡£
ÕâÑùºÜÈÝÒ׿´³ö£¬Èç ¹ûÎÒÃÇÏëÒªÔÚÊý¾ÝÌá½ ......