ASP.NETÃæÊÔÌ⡾»ã×ÜÌù¡¿
1¡¢SessionÓÐʲôÖØ´óBUG£¬Î¢ÈíÌá³öÁËʲô·½·¨¼ÓÒÔ½â¾ö£¿
´ð£ºÊÇiisÖÐÓÉÓÚÓнø³Ì»ØÊÕ»úÖÆ£¬ÏµÍ³·±Ã¦µÄ»°Session»á¶ªÊ§£¬¿ÉÒÔÓÃSate server»òSQL ServerÊý¾Ý
¿âµÄ·½Ê½´æ´¢Session²»¹ýÕâÖÖ·½Ê½±È½ÏÂý£¬¶øÇÒÎÞ·¨²¶»ñSessionµÄENDʼþ¡£
2.²úÉúÒ»¸öintÊý×飬³¤¶ÈΪ100£¬²¢ÏòÆäÖÐËæ»ú²åÈë1-100£¬²¢ÇÒ²»ÄÜÖظ´¡£
C# code
int[] intArr=new int[100];
ArrayList myList=new ArrayList();
Random rnd=new Random();
while(myList.Count<100)
{
int num=rnd.Next(1,101);
if(!myList.Contains(num))
myList.Add(num);
}
for(int i=0;i<100;i++)
intArr[i]=(int)myList[i];
3.ADO.netÖг£ÓõĶÔÏóÓÐÄÄЩ£¿·Ö±ðÃèÊöһϡ£
´ð£ºConnection Êý¾Ý¿âÁ¬½Ó¶ÔÏñ
Command Êý¾Ý¿âÃüÁî
DataReader Êý¾Ý¶ÁÈ¡Æ÷
DataSet Êý¾Ý¼¯
4.<%# %> ºÍ <% %> ÓÐʲôÇø±ð£¿
´ð£º<%# %>±íʾ°ó¶¨µÄÊý¾ÝÔ´
<% %>ÊÇ·þÎñÆ÷¶Ë´úÂë¿é
Asp.netÇå¿ÕÒ³ÃæÉϵÄËùÓÐTextBox
C# code
foreach (Control c in this.FindControl("form1").Controls)
{
if (c is TextBox)
{
((TextBox)c).Text = "";
}
}
¿Í»§¶Ëʼþ
JScript code
<script language="javascript" type="text/javascript">
function ClearAllTextBox() {
var obj = window.document.forms[0];
for (i = 0; i < obj.elements.length; i++) {
var elem = obj.elements[i];
if (elem) {
if (elem.type == "text") {
elem.value = "";
}
}
}
}
</script>
C# code
Random r = new Random();
List<int> iNumberList = new List<int>();
int i = r.Next(1, 100);//µÚÒ»¸öÊý²»¿ÉÄÜÖظ´ ËùÒÔÏÈ°ÑËüÌí¼Ó½øÈ¥
iNumberList.Add(i);
while (iNumberList.Count < 100)
{
while (iNumberList.Contains(i))
{
i = r.Next(1, 101);
}
iNumberList.Add(i);
}
2.ʲôÊÇASP.netÖеÄÓû§¿Ø¼þ
´ð:Óû§¿Ø¼þ¾ÍÊÇ.ascxÀ©Õ¹ÃûµÄ¶«Î÷à¶,
Ïà¹ØÎĵµ£º
---------------------------------------
Asp.Net,C#,SQL,JS,WCF,AJAX,¹¤×÷Á÷,WPF,MVC,LINQ,Éè¼Æģʽ(¼Ü¹¹)µÈ¼¼ÊõÌÖÂÛ
“ASP.NET(C#)Fans” QQȺ£º96877690
---------------------------------------
²»¹ÜÊÇJ2SE¡¢J2EE»¹ÊÇJ2ME¾´Çë¼ÓÈ룡Eclipse¡¢NetBeans
Java½»Á÷QQ¸ß¼¶ÈºÀ©ÕУº96878255 ......
Ò».ÕªÒª
¡¡¡¡±¾ÎĽ²½âÔÚActionÖÐÏòView´«µÝModelµÄ¼¸ÖÖ·½Ê½.ÒÔ¼°View»ñÈ¡ModelÒÔºóÈçºÎ±àдÏÔʾÂß¼.»¹ÏêϸµÄ½éÉÜÁËASP.NET MVC¿ò¼ÜÌṩµÄHtml HelperÀàµÄʹÓü°ÈçºÎΪHtml HelperÀàÌí¼Ó×Ô¶¨ÒåÀ©Õ¹·½·¨.
¡¡¡¡¶þ.³ÐÉÏÆôÏÂ
¡¡¡¡ÉÏһƪÎÄÕÂÖÐÎÒÃÇѧϰÁËController´¦ÀíÒ»´ÎÇëÇóµÄÈ«¹ý³Ì.ÔÚControllerµÄActionÖÐ, »á´«µÝÊý¾Ý¸ ......
1. ¼òÊö private¡¢ protected¡¢ public¡¢ internal ÐÞÊηûµÄ·ÃÎÊȨÏÞ¡£
´ð . private : ˽ÓгÉÔ±, ÔÚÀàµÄÄÚ²¿²Å¿ÉÒÔ·ÃÎÊ¡£
protected : ±£»¤³ÉÔ±£¬¸ÃÀàÄÚ²¿ºÍ¼Ì³ÐÀàÖпÉÒÔ·ÃÎÊ¡£
public : ¹«¹²³ÉÔ±£¬ÍêÈ«¹«¿ª£¬Ã»ÓзÃÎÊÏÞÖÆ¡£
internal: ÔÚͬһÃüÃû¿Õ¼äÄÚ¿ÉÒÔ·ÃÎÊ¡£
2 .ÁоÙASP.NET Ò³ÃæÖ®¼ä´«µÝÖµµÄ¼¸ÖÖ·½Ê½¡£
´ ......
UpdatePanel¿ØÖÆÒ³ÃæµÄ¾Ö²¿¸üУ¬Õâ¸ö¸üй¦ÄÜÒÀÀµÓÚscriptManger¿Ø¼þµÄEnablePartialRenderingÊôÐÔ£¬Èç¹ûÕâ¸öÊôÐÔÉèÖÃΪfalse¾Ö²¿¸üлáʧȥ×÷ÓÃ(scriptManger¿Ø¼þµÄEnablePartialRenderingÊôÐÔµÄĬÈÏֵΪtrue²»±Ø¿ÌÒâÈ¥ÉèÖÃ)
ÏÂÃæÊÇÒ»¸öÍêÕûµÄUpdatePanelµÄ½á¹¹£º
¸´ÖÆ´úÂë ´úÂëÈçÏÂ:
<asp:ScriptManager  ......