Ïê½âAsp.net MVC DropDownLists
Asp.net MVCÖеÄDropDownListsòËÆ»áÈÃÒ»¿ªÊ¼´ÓAsp.net Formsת¹ýÀ´µÄ³ÌÐòÔ±Ôì³É²»ÉÙÃÔ»ó.ÕâƪÎÄÕ½²ÊöÁËΪÁËʹÓÃDropDownLists,ÄãÐèÒªÔÚAsp.Net MVCÖÐÖªµÀµÄ·½·½ÃæÃæ.
DropDownList,ComboBox,ÎÞÂÛÄãϲ»¶Ôõô³ÆºôÕâЩ£¬ËûÃǺÁÎÞÀýÍâµÄ»á±»Éú³ÉΪhtml select±êÇ©. ÔÚ<select>¿ª±êÇ©ºÍ</select>±Õ±êÇ©Ö®¼ä£¬Ã¿Ò»¸öÁбíÔªËض¼±ØÐë±»°ü¹üÓÚ<option>±êÇ©.µ±È»ÄãÒ²¿ÉÒÔʹÓÃ<optgroup>±êÇ©½«¸÷¸öÑ¡Ïî°´Âß¼ÉϷֳɲ»Í¬µÄ×é¡£Èç¹ûÕë¶Ô<option>ÉèÖÃÁËvalueÊôÐÔ£¬Ôò ValueÊôÐÔ¾ÍÊÇÔÚformÌύʱselectÔªËصÄÖµ.¶øÈç¹ûÍüÁ˸øvalueÊôÐÔ¸³Öµ£¬ÔòÔÚ<option></option>±êÇ©ÄÚ°ü¹üµÄÄÚÈÝÔòÊDZ»Ìá½»µÄÖµ¡£
ΪÁ˼ò±ãÆð¼û£¬ÕâÀïÎÒÏÈÓÃÒ»¸ö¾²Ì¬µÄÁбí×÷ΪÀý×Ó£¬Äã¿ÉÒÔ½«ÕâЩ×÷ΪhtmlÖ±½Ó¼ÓÈëµ½ÄãµÄViewÖÐ:
<select name="year">
<option>2010</option>
<option>2011</option>
<option>2012</option>
<option>2013</option>
<option>2014</option>
<option>2015</option>
</select> »òÕߣ¬¸øÁбí¼ÓµãС¶¯Ì¬£¬¼ÙÈçÐèÒªÁбíµÄÄê·Ý»áËæ×ÅÐÂÄêµ½À´Ö®¼Ê×Ô¶¯ÍùºóÍÆ1Ä꣺
<select name="year">
<option><%= DateTime.Now.Year %></option>
<option><%= DateTime.Now.AddYears(1).Year %></option>
<option><%= DateTime.Now.AddYears(2).Year %></option>
<option><%= DateTime.Now.AddYears(3).Year %></option>
<option><%= DateTime.Now.AddYears(4).Year %></option>
<option><%= DateTime.Now.AddYears(5).Year %></option>
</select>
ÉõÖÁ¿ÉÒÔ¸ü¼ò±ã£º
<select name="year">
<% for (var i = 0; i < 6; i++){%>
<option><%= DateTime.Now.AddYears(i).Year %></option>
<%}%>
</select> ÉÏÃæÈý¸ö´úÂë¶ÎÉú³ÉЧ¹ûÏàͬ£¬ÈçÏ£º
&n
Ïà¹ØÎĵµ£º
DateTime dt = DateTime.Now;
// Label1.Text = dt.ToString();//2005-11-5 13:21:25
// Label2.Text = dt.ToFileTime().ToString();//127756416859912816
// Label3.Text = dt.ToFileTimeUtc().ToString();//127756704859912816
// Label4.Text = dt.ToLocalTime().ToString();//2005-11-5 21:21:25
// Label5.Text = ......
±¾ÎÄΪÖйúASP.NET¿ª·¢ÍøÔ´´ÎÄÕ£¬×ªÔرØÐë×¢Ã÷³ö´¦¡£ Ãû³Æ£º ASP.NET
µØÖ·£ºhttp://www.asp.net
½éÉÜ£ºÎ¢Èí.NET webformµÄÀϳ²£¬×ÊÁϺÍʵÀý´úÂ붼·Ç³£Äѵá£
Ãû³Æ£º CSDNÎĵµÖÐÐÄ loveswallow998 58213998
µØÖ·£ºhttp://dev.csdn.net/
½éÉÜ£ºÖÐÎĵģ¬×ÊÁÏ»¹Ëã·á¸»£¬¿ÉÒÔ×÷Ϊ¹úÄÚÊ×Ñ¡¡£ ......
//postÇëÇó
string name = Request["name"].toString();
string name =Request.Form.Get("name").toString();
//getÇëÇó
string name = Request.QueryString["name"].toString();
µ«ÎÒ·¢ÏÖ ÎÞÂÛÊÇ·ñÊÇpostÓëget´«Öµ¶¼¿ÉÓÃ
string name = Request["name"].toString();
±íµ¥Ìá½»ÖÐgetºÍpost·½Ê½µÄÇø±ð¹éÄ ......
ÔÚweb³ÌÐòÖУ¬¾³£»áʹÓÃÔÚÒ»¸öÍøҳʹÓÃÆäËûÍøÒ³Ìá½»µÄÊý¾ÝÐÅÏ¢£¬ÕâÀï¿ÉÒÔʹÓÃRequestÄÚÖöÔÏóÀ´Íê³É£¬À´»ñÈ¡Óû§Ìá½»µÄÐÅÏ¢£¬¸ù¾Ý¿Í»§¶ËÌá½»Êý¾Ý·½Ê½µÄ²»Í¬£¬Request¶ÔÏó·Ö±ðʹÓÃFormºÍQueryString¼¯ºÏÊôÐÔÀ´»ñÈ¡Êý¾Ý¡£ÏÂÃæÊÇÁ½ÖÖ¼¯ºÏ»ñÈ¡·½Ê½µÄ²»Í¬µã£ºÍ¨¹ýForm»ñÈ¡Êý¾ÝʱÔÚformÊôÐÔÖмòµ¥µÄÌí¼Óaction=“ÌøתµÄÍøÒ³ ......