asp.net ÔÚǰ̨ºÍºǫ́µ÷Óà javascript º¯Êý
1¡¢Ö±½ÓÔÚǰ̨µ÷Óà javascript º¯Êý
ºÜ¼òµ¥,ÔÚ head ÔªËØÖ®¼ä¼ÓÈë script ÔªËØ,½« type ÔªËØÉèÖÃΪ " text/javascript "
Èç:
<head runat="server">
<mce:script type="text/javascript" ><!--
function ShowName(str)
{
alert("ÄúµÄÃû×ÖΪ:("+str+")");
}
// --></mce:script>
<title>using javascript</title>
</head>
Ö®ºóÔÚbody ÔªËؼä,ͨ¹ýʼþÀ´·ÃÎÊ Èç Ҫͨ¹ýbutton1 µÄµ¥»÷ʼþ(onclientclick)À´·ÃÎÊ javascript º¯Êý
ʾÀýÈçÏÂ:
<asp:Button ID="Button1" runat="server" Text="Button" onclientclick="ShowName('XXX')" />
ÕâʱÔËÐÐÏîÄ¿,µ¥»÷ buttonʱ,»áÏÔʾ"ÄúµÄÃû³ÆΪXXX"
Õâ¾ÍÊÇÒ»¸ö¼òµ¥µÄjavascript º¯Êý.
2¡¢ÔÚǰ̨ͨ¹ý jsÎļþ µ÷ÓÃ
·½·¨Óë £¨1£©Ò»Ñù Ö»²»¹ýÐèÒªÖ¸¶¨ .js Îļþ
ʾÀýÈçÏÂ:
<head runat="server">
<mce:script type="text/javascript" src="JScript.js" mce_src="JScript.js"></mce:script>
<title>using javascript</title>
</head>
Ö®ºóÔÚbody ÔªËؼä,ͨ¹ýʼþÀ´·ÃÎÊ Èç Ҫͨ¹ýbutton1 µÄµ¥»÷ʼþ(onclientclick)À´·ÃÎÊ javascript º¯Êý
ʾÀýÈçÏÂ:
//´Ëʱ .jsÎļþÖбØÐëÓÐ ShowName ·½·¨
<asp:Button ID="Button1" runat="server" Text="Button" onclientclick="ShowName('XXX')" />
3¡¢ÔÚºǫ́µ÷Óà javascript º¯Êý,º¯ÊýÔÚ.jsÎļþÖÐ
ǰ̨µÄhead ÔªËØ
<head runat="server">
<mce:script type="text/javascript" src="JScript.js" mce_src="JScript.js"></mce:script>
<title>using javascript</title>
</head>
ºǫ́µÄÐèÒªÌí¼ÓÈçÏ´úÂë
Button1.Attributes.Add("onclick", "showname1(XXX)");
4¡¢ÔÚºǫ́µ÷Óà javascript º¯Êý,º¯ÊýдÔÚ .jsÎļþÖÐ,µ«²¢Ã»ÓÐÔÚǰ̨¶¨Òå
//»ñµÃ.jsÎļþ
string myscript = "JScript.js";
//×¢²á.jsÎļþ, Èç¹û´Ëʱ²é¿´Ô´Âë,»áµÃµ½ÈçÏ´úÂë
//<script> src ="JScript.js" type="text/javascript"><script>
Page.ClientScript.RegisterClientScriptInclude("myKey", myscript);
//ͬÉÏ
Button1.Attributes.Add("onclick", "showname1(123)");
Ïà¹ØÎĵµ£º
ÓÃÀ´ÅÅÐò¶ÔÏñÊý×éµÄ. ×îºó»¹ÊǾö¶¨ÓÃArray¶ÔÏñµÄsort·½·¨£¬¾¡¹ÜÕâЩ¶¼Ã»ÓÃÉÏ£¬»¹ÊÇ×Ô¼º¼ÇÔÚ¿Õ¼äÀïµ±±Ê¼ÇÓõÄ.
¿ìËÙÅÅÐò£¬ÓÅ»¯µÄ¿ìËÙÅÅÐò£¬ÍüÁËÃû×ÓµÄÅÅÐò·½·¨£¬¶ÔÏñÌṩµÄÅÅÐò; ¾ø¶Ô²»ÒªÓÃÆðÅÝ·¨£¬³ý·ÇÊǽÌѧÉú¡£
ΪÁ˲âÊÔ£¬Ð´ÁËÒ»¸öÉú³ÉËæ»ú¶ÔÏñµÄ·½·¨£¬ÓÃÀ´Éú³ÉÒ»¸ö¶ÔÏñ£¬¶ÔÏñÖÐÓÐÒ»¸öÊôÐÔ a £¬a µÄֵΪһ¸öËæ»úÊ ......
using (con)
{
con.Open();
String sqltext = "select * from emp where empno=@empno";
......
ÔÚASP.NETÓ¦ÓóÌÐò³£³£»áÓöµ½ÐèÒª´ÓExcelÎļþÖжÁÈ¡Êý¾Ý»ò½«Êý¾ÝдÈëExcelµÄÐèÇó¡£Ò»°ãÀ´½²£¬ÔÚASP.NETÖжÁдExcelÎļþÓÐËÄÖÖ½â¾ö·½°¸¡£
1.1.1 ʹÓÃOLE DB
ʹÓÃOLE DB¿ÉÒÔÒÔ²éѯÊý¾Ý¿âµÄ·½Ê½À´¶ÁÈ¡ExcelÎļþ£¬ÒòΪÔÚijÖ̶ֳÈÉÏExcel±í¸ñ¿ÉÒÔ¿´³ÉÊÇÒ»ÕÅÒ»ÕŵÄÊý¾Ý±í¡£Æä¶þÕßµÄÖ÷ÒªÇø±ðÔÚÓÚËùʹÓõÄÊý¾ÝÒýÇæ²»Ò»Ñù¡£Ê¹ÓÃOLE ......
±¾ÎÄÊǶԡ¶AJAX¶¯Ì¬ÍøÒ³ÐÅÏ¢ÌáÈ¡ÔÀí¡·
µÄ²¹³ä£¬Ç°ÎÄ×ܽáÁËÁ½ÖÖAJAXÍøÒ³ÎÄ×ÖµÄץȡ·½·¨£º
ÍøÒ³ÎÄ×ÖÔÚ¼ÓÔØHTMLÎĵµ£¨document£©µÄʱºòÓÃJavascript´úÂë»ñÈ¡ºÍÕ¹ÏÖ£¬´ËJavascript´úÂëÔÚ·¢ËÍloadʼþ֮ǰÔËÐУ¬ÄÇô½ÓÊÕµ½loadʼþ±íʾËùÓеÄÄÚÈݶ¼¼ÓÔØÍêÁË
ÍøÒ³ÎÄ×ÖÔÚ¼ÓÔØÍêHTMLÎĵµ£¨document£©ºóÔÚij¸öʱ¿ÌÓÃJavascript ......
Document¶ÔÏóÄÚÈݼ¯ºÏ
document Îĵ²¶ÔÏó - JavaScript½Å±¾ÓïÑÔÃèÊö
———————————————————————
×¢:Ò³ÃæÉÏÔªËØnameÊôÐÔºÍJavaScriptÒýÓõÄÃû³Æ±ØÐëÒ»Ö°üÀ¨´óСд
·ñÔò» ......