Ïê½â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
Ïà¹ØÎĵµ£º
1. ´ò¿ªÐµĴ°¿Ú²¢´«ËͲÎÊý£º
¡¡¡¡´«ËͲÎÊý£º
response.write("£¼script£¾window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)£¼/script£¾")
¡¡¡¡½ÓÊÕ²ÎÊý£º
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
¡¡¡¡2.Ϊ°´Å¥Ìí¼Ó¶Ô»°¿ò
Button1 ......
ÒÔÏÂÊǵ¼³öµÄ·½·¨£º
public static void ToExcel(System.Web.UI.Control ctl)
{
//HttpContext.Current.Response.Charset ="GB2312";
HttpContext.Current.Response.Charset = "G ......
(Ò»).Web.ConfigÊÇÒÔXMLÎļþ¹æ·¶´æ´¢,ÅäÖÃÎļþ·ÖΪÒÔϸñʽ
1.ÅäÖýڴ¦Àí³ÌÐòÉùÃ÷
Ìص㣺 λÓÚÅäÖÃÎļþµÄ¶¥²¿£¬°üº¬ÔÚ<configSections>±êÖ¾ÖС£
2.Ìض¨Ó¦ÓóÌÐòÅäÖÃ
Ìصã: λÓÚ<appSetting>ÖС£ ¿ÉÒÔ¶¨ÒåÓ¦ÓóÌÐòµÄÈ«¾Ö³£Á¿ÉèÖõÈÐÅÏ¢.
3.ÅäÖýÚÉèÖÃ
Ìصã: λÓÚ<system.Web>½ÚÖУ¬¿ØÖÆAsp.netÔËÐÐÊ ......
Ö»ÓÐÔÚ¡òPageÖ¸ÁîÖÐÉèÖÃÁË£ºAutoEventWireup="true"£¬·þÎñÆ÷¶ËµÄ±àÒëÆ÷½«°´ÕÕ Page_eventname ·½·¨ÃûµÄÐÎʽ×Ô¶¯µÄ¼ì²éÏàӦʼþ´¦Àí·½·¨£¬×Ô¶¯ÊµÏÖʼþµÄ¶©ÔÄ¡£
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System ......