asp.netÔÚÓÃajaxµÄʱºòÈçºÎµ¯³ö¶Ô»°¿ò
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:updatepanel ID="UP" runat="server">
<ContentTemplate>
<asp:Button runat="server" Text="Button" onclick="Unnamed2_Click" />
</ContentTemplate>
</asp:updatepanel>
</div>
</form>
ASP.NET2.0ÖÐAJAXʹÓÃеÄManager ÀàÀ´¹ÜÀí£¬¶ø²»¼æÈÝÔÀ´µÄ ClientManager Àà ,ËùÒÔÓÃresponse.write("<script>alert('Ìáʾ£ºµãÎÒÁË!')</script>")ºÍ
this.Client.RegisterClientBlock(this.GetType(), "name", "<>alert('Ìáʾ£ºµãÎÒÁË!');</>", true);
Page.Client.RegisterClientBlock(this.GetType(), "name", "<>alert('Ìáʾ£ºµãÎÒÁË!);</>", true);
ÕâЩ·½·¨¶¼ÊÇÎÞЧµÄ.
¿ÉÒÔÓÃÒÔÏ·½·¨Ð´´úÂëʵÏÖ
ScriptManager.RegisterStartupScript(UP, UP.GetType(), "", "alert('µãÎÒÁË');", true);
ÕâÑù¾Í¿ÉÒÔʵÏÖÁË!
//UPÊÇupdatepanel µÄID
ת×Ôhttp://www.csharp360.com/bbs/viewthread.php?tid=233&extra=
Ïà¹ØÎĵµ£º
If Óï¾äÔÚASP.NETÖеÄÓ¦ÓÃ
ÔÚASP.NETÖÐÓÐÐí¶àµØ·½ÒªÓõ½“ifÓï¾ä”£¬ÆäʵifÓï¾äÊÇC# ·ÖÖ§½á¹¹ ÖеÄÒ»ÖÖ¡£
·ÖÖ§½á¹¹ÊÇÓÐÌõ¼þµÄÖ´ÐдúÂ룬¿ØÖÆÏÂÒ»²½ÒªÖ´ÐÐÄÄЩ´úÂëµÄ¹ý³Ì¡£
·ÖÖ§½á¹¹£º
1£®ifÓï¾ä
2£®SwitchÓï¾ä
½ñÌìËù½²µÄÄÚÈÝΪif Óï¾ä£º
Ê×ÏÈC#ÖÐif½á¹¹µÄÓï·¨ÈçÏ£º
If (±í´ïʽ)
{
´úÂë¿ ......
Èç¹û²âÊÔµÄurlµØÖ·ÊÇhttp : //www.test.com/testweb/default.aspx, ½á¹ûÈçÏ£º
Request.ApplicationPath: /testweb
Request.CurrentExecutionFilePath: /testweb/default.aspx
Request.FilePath: /testweb/default.aspx
Request.Path: /testweb/default.aspx
Request.PhysicalApplicationPath: E:\WWW\testwebReq ......
using System.Text.RegularExpressions;
Regex reg = new Regex(@"^\d+$"); //ÑéÖ¤×Ö·û´®
Response.Write( reg.IsMatch(""));
Response.Write(reg.IsMatch("sf"));
Response.Write ......