Asp.Net ĬÈÏ°´Å¥
·½·¨Ò»£º
function document.onkeydown()
{
if(event.keyCode==13)
{
document.form1.all.Submit.click(); //ÕâÀïµÄsubmitÊÇ°´Å¥µÄID
}
}
·½·¨¶þ£º
<form id="form1" runat="server" defaultbutton="button1">
<div>
<asp:Panel DefaultButton="button1"></asp:Panel>
<asp:Button ID="button1" runat="server" Text="Button1" />
</div>
</form>
·½·¨Èý£º
ÔÚPage_LoadÖмÓÈëÈçÏ´úÂë
TextBox.Attributs.Add("onkeydown","if(keyCode==13) {document.all.Button2.focus(); document.all.Button2.click();}");
·½·¨ËÄ£º
<form id="form1" runat="server" defaultbutton="Ok">
<!--ÉèÖÃformµÄÊôÐÔ defaultbutton£½“ĬÈÏ°´Å¥ID” Õâ¸öÊÇÎÒÔÚVS2005ÖÐʽµÄ-->
·½·¨Î壺
2¸öÒÔÉϵÄtextbox,ÏÈÅжϽ¹µãÔÚÑ¡Ôñ¶ÔÓ¦µÄ°´Å¥
<script type="text/javascript">
function document.onkeydown()
{
if(event.keyCode==13)
{
if(document.activeElement.id == "Text1")
{
document.form1.all.Button1.click(); //ÕâÀïµÄsubmitÊÇ°´Å¥µÄID
}
else if(document.activeElement.id == "Text2")
{
document.form1.all.Button2.click(); //ÕâÀïµÄsubmitÊÇ°´Å¥µÄID
}
}
}
</script>
<input id="Text1" type="text" />
<input id="Button1" type="button" value="button" onclick="javascript:alert('Button1 is onclick!')" />
<br />
<input id="Text2" type="text" />
<input id="Button2" type
Ïà¹ØÎĵµ£º
ÔÚEmailϵͳÖо³£»áÉÏ´«¶à¸öÎļþµ½·þÎñÆ÷£¬Óû§´ó¶àÏ°¹ßÒ»´ÎÉÏ´«ËùÓеÄÎļþ£¬¶ø²»ÊÇÖð¸öÉÏ´«£¬ÎÒÃÇ¿ÉÒÔʹÓÃjavascript¶¯Ì¬µØÌí¼ÓfileÔªËص½±íµ¥£¬È»ºóÔÚ·þÎñÆ÷¶Ë´¦ÀíÕâЩfile
Ч¹ûͼÈçÏÂ:
Ò³Ãæ´úÂëMutlileFileUpload.aspxÈçÏÂ:
view plaincopy to clipboardprint?
<%@ Page Language="C#" AutoEventWireup="true" C ......
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" & ......
1.Asp.NetÖм¸ÖÖÏàËƵıê¼Ç·ûºÅ: <%=...%> <%#... %> <% %> <%@ %> ½âÊͼ°Ó÷¨
´ð: <%#... %>: ÊÇÔڰ󶨿ؼþDataBind()·½·¨Ö´ÐÐʱ±»Ö´ÐУ¬ÓÃÓÚÊý¾Ý°ó¶¨
Èç: <%# Container.DataItem("tit") %>
&n ......
Asp.netΪÎÒÃÇÌṩÁËÁù¸öÑéÖ¤ÑéÖ¤¿Ø¼þ¼°ÆäÒªÆð×÷ÓñØÐëÉèÖõÄÊôÐÔ£º
(1) RequiredFieldValidator£º¸Ã¿Ø¼þÒªÇóÆä°ó¶¨µÄÊäÈë¿Ø¼þÒ»¶¨ÒªÓÐÊäÈëÖµ£¬²»ÄÜΪ¿Õ£»
ÊôÐÔ£ºControlToValidate:ÑéÖ¤¿Ø¼þÒªÑéÖ¤µÄÊäÈë¿Ø¼þID£¨°ó¶¨µÄÊäÈë¿Õ¼äID£©
Text£ºÊäÈë¿Ø¼þÊäÈëµÄÄÚÈݲ» ......
Model-View-Controller (MVC) ¼Ü¹¹Ä£Ê½½«Ò»¸öÓ¦ÓóÌÐò·ÖΪÈý¸ö×é³É²¿·Ö:Ä£ÐÍ£¬ÊÓͼÓë¿ØÖÆÆ÷¡£ASP.NET MVC¿ò¼ÜΪ´´½¨»ùÓÚMVCµÄWebÓ¦ÓóÌÐòÌṩÁËÒ»ÖÖÌæ´ú·½°¸¡£ASP.NET MVC¿ò¼ÜÊÇÒ»¸öÇáÁ¿¼¶µÄ£¬¿É¸ß¶È²âÊÔµÄչʾ¿ò¼Ü£¨»ùÓÚWeb´°ÌåµÄÓ¦ÓóÌÐò£©£¬Ëü¼Ì³ÐÁËÏÖÓеÄASP.NETÌØÐÔ£¬±ÈÈçĸ°æÒ³ºÍ³ÉÔ±×ʸñȨÏÞ¡£ MVC¿ò¼Ü¶¨Ò ......