Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¿ØÖÆAsp.netµÄButton¿Ø¼þµÄÌá½»¶¯×÷

asp.net¿ª·¢ÖУ¬Í¨³£ÐèÒª×öһЩ¿Í»§¶ËÑéÖ¤¡£µ±ÎÒÃÇĬÈÏÔÚÒ»¸öÒ³ÃæÖмӸöbutton¿Ø¼þʱ£¬Õâ¸öButton±»asp.net Êä³öΪһ¸öSubmit°´Å¥¡£ asp:Button ID=Button1 runat=server Text=Button on click=Button1_Click /
ÔÚ_doPostBack·½·¨ÄÚ£¬Í¨¹ýtheForm.submit()À´Ê¹Êý¾ÝÌá½»µ½·þÎñÆ÷¡£
ÕâÑùºÜÈÝÒ׿´³ö£¬Èç ¹ûÎÒÃÇÏëÒªÔÚÊý¾ÝÌá½»µ½·þÎñÆ÷¶ËÇ°×öЩÑéÖ¤µÄÊÂÇ飬¾ÍÒªÊ×ÏÈÔÚ_doPostBack֮ǰ×öЩ´¦Àí£¬²¢Ê¹Êý¾ÝÑéÖ¤Ö»ÓдﵽÁËÒªÇó ºó£¬²Å¿ÉÒÔµ÷ÓÃ_doPostBackʹÊý¾Ý»Ø´«¡£ÎÒÃÇÊ×ÏȸøButton¼ÓÒ»¸ö OnClientClickÊôÐÔ£¬¸øOnClientClick ÊôÐÔÖ¸¶¨Ò»¸öJS·½·¨Test():
<asp:Button ID="Button1" OnClientClick="test();" UseSubmitBehavior="false" runat="server"  Text="Button" onclick="Button1_Click" />
JS´úÂëÈçÏ£º
1: function test()
2: {
3: alert("test");
4: return false ;
5: }
 
ÔÙ¿´Ò»Ï¾­¹ý·þÎñ¶Ë½âÎöºóÊä³öµÄ¿Ø¼þHTML´úÂë:
<input type="button" name="Button1" value="Button" onclick="test();__doPostBack('Button1','')" id="Button1" />
ÎÒÃÇ¿´µ½test·½·¨Ö´ÐÐÊÇÔÚ_doPostBack֮ǰ£¬µ±ÎÒÃǵ㰴ťʱ£¬ Ò³Ãæ»áµ¯³ö test ¾¯¸æ£¬µ«ÊÇÈÔÈ»»á¼ÌÐøÌá½»Êý¾Ýµ½·þÎñÆ÷¡£Èç¹û²»ÏëÌá½»Êý¾Ýµ½·þÎñÆ÷£¬¾ÍÒªÏë°ì·¨×èÖ¹_doPostBackÖ´ÐС£µ½ÁËÕâÒ»²½£¬½â¾ö°ì·¨¾ÍºÜÃ÷°×ÁË£¬ÎÒÃÇÖ» ÐèÒª°Ñonclick±ä³É test();return;_dopostBack('Button1','')¾Í¿ÉÒÔÁË¡£Èç¹ûÐèÒªtest()·½·¨µÄÅжϽá¹û²Å¾ö¶¨ÊÇ·ñÌá½»Êý¾Ýµ½·þ ÎñÆ÷£¬ÎÒÃÇÐèÒªÕâÑù¸Ä¶¯ if(!test())return;_dopostBack('Button1','')¡£
´ò¿ªaspxÔ´ ´úÂ룬°ÑOnClientClick¸Ä³ÉOnClientClick= "if(!test())return; "ÎÒÃÇÔÙ¿´Ò»ÏÂHTMLµÄÊä³ö£º
<input type="button" name="Button1" value="Button" onclick="if(!test())return;__doPostBack('Button1','')" id="Button1" />
ÔËÐвâÊÔ£¬Âú×ãÒªÇó¡£
ÕâÖ»ÊÇÒ»ÖÖ½â¾ö°ì·¨£¬»¹ÓоÍÊÇÖØд Button£¬×Ô¼º¿ØÖÆonclickµÄÊä³ö»òÕßÀûÓÃÑéÖ¤¿Ø¼þ¡£
»¹ÓÐÈçÏ·½Ê½Ò²¿É½â¾ö£º
---------------------------------------------------------------------------------------------------------------
Ò»¸öÒ³Ã棬ÓÐÒ»¸öÎı¾¿òºÍÒ»¸öÌá½»°´Å¥£¬Í¬Ê±ÓÐÒ»¸öÑéÖ¤¿Ø¼þÀ´ÑéÖ¤Îı¾¿òÖеÄÊäÈ룬µ¥»÷BUTTONʱͬʱҪ´¥·¢Ò»¸öjavascript ½Å±¾¡£
ÔÚPageLoadÖмÓÈ룺Button1.Attribute.Add("onclick","return CheckOther()");
ÔËÐÐʱÌáʾ·¢Éú½Å±¾´í


Ïà¹ØÎĵµ£º

asp.net×Ô¶¨Òå´íÎó´¦ÀíÒ³ÃæµÄ¼¸ÖÖ·½·¨

ASP.NET ÌṩÈýÖÖÓÃÓÚÔÚ³öÏÖ´íÎóʱ²¶»ñºÍÏìÓ¦´íÎóµÄÖ÷Òª·½·¨£ºPage_Error ʼþ¡¢Application_Error ʼþÒÔ¼°Ó¦ÓóÌÐòÅäÖÃÎļþ (Web.config)¡£
Èç¹ûÄú²»µ÷Óà Server.ClearError »òÕß²¶»ñ Page_Error »ò Application_Error ʼþÖеĴíÎó£¬Ôò½«¸ù¾Ý Web.config ÎļþµÄ <customErrors> ²¿·ÖÖеÄÉèÖô¦Àí´íÎó¡£ÔÚ <cus ......

ASP.NetÎåÖÖ»º´æ»úÖÆ

Application
1.ApplicationÓÃÀ´±£´æËùÓÐÓû§¹²ÓõÄÐÅÏ¢
2.ÔÚAspʱ´ú£¬Èç¹ûÒª±£´æµÄÊý¾ÝÔÚÓ¦ÓóÌÐòÉú´æÆÚÄÚ²»»á»òÕߺÜÉÙ·¢Éú¸Ä±ä£¬ÄÇôʹÓÃApplicationÊÇÀíÏëµÄÑ¡Ôñ¡£µ«ÊÇÔÚAsp.net¿ª·¢»·¾³ÖÐÎÒÃÇ°ÑÀàËƵÄÅäÖÃÊý¾Ý·ÅÔÚWeb.configÖС£
3.Èç¹ûҪʹÓÃApplication ҪעÒâµÄÊÇËùÓеÄд²Ù×÷¶¼ÒªÔÚApplication_OnStartʼþÖÐÍê³É ......

Asp.net Ajax webserviceʱ¼ä´Á

  ÔÚʹÓÃAJAX½øÐгÌÐò¿ª·¢µÄʱºò£¬Ò»Ö±¶¼»áÃæ¶ÔÒ»¸ö»º´æµÄÎÊÌ⣡£¡
¼´ÊÇ£¬ÉÏ´ÎÇëÇóµÄʱºò£¬ÒòΪÄãµÄSQLÓï¾ä»òÕßÆäËûÔ­Òò£¬webserviceÖзµ»ØֵΪ¿Õ£¬²»ÊÇÄãÏëÒªµÄ½á¹û¼¯£¬ÔÚÄã·¢ÏÖwebserviceÖÐÓï¾äÌå³ö´íºó£¬½øÐÐÐ޸ģ¬ÖØвâÊÔ£¬ÈÔÈ»ÊÇÉϴεķµ»Ø½á¹û£¡¸Ð¾õ¾ÍÏñÄãµÄÐÞ¸ÄÍêÈ«ÎÞЧ¡£¡£
   Æäʵ£¬ÕâÊÇÔÚAJAXµ ......

apss asp.net C# web ¶¨Ê±Ö´ÐгÌÐò

using System;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.SessionState;
using System.Timers;
using System.Data;
using System.Data.SqlClient;
namespace SMS_joke
{
/// <summary>
/// Global µÄժҪ˵Ã÷¡£
/// </summary>
public class ......

ASP.NET"ÕýÔÚÖÐÖ¹Ïß³Ì"´íÎóÔ­Òò

PRB£ºÔÚʹÓà Response.End¡¢Response.Redirect »ò Server.Transfer ʱ³öÏÖ ThreadAbortException
Ö¢×´
Èç¹ûʹÓà Response.End¡¢Response.Redirect »ò Server.Transfer ·½·¨£¬½«³öÏÖ ThreadAbortException Òì³£¡£Äú¿ÉÒÔʹÓà try-catch Óï¾ä²¶»ñ´ËÒì³£¡£
Ô­Òò
Response.End ·½·¨ÖÕÖ¹Ò³µÄÖ´ÐУ¬²¢½«´ËÖ´ÐÐÇл»µ½Ó¦ÓóÌÐò ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ