2009年6月1日 星期一

在asp.net得到request 中 相同id的值


方法一
string
[] nameParts = Request.Params.GetValues("txtName");
string firstName = nameParts[0];
string middleName = nameParts[1];
string lastName = nameParts[2];
方法二

string s = "";
NameValueCollection coll;
coll=Request.Form;
if(Request.Form["cols1"]!=null)
{
//NameValueCollection coll;
//String[] arr1 = coll.AllKeys;
String[] arr1 = coll.GetValues("cols1");
for(int i=0;i < arr1.Length;i++)
{
s+=arr1[i].ToString();
}


Response.Write(s);
}

}


================================
需要System.Collections.Specialized

-------------------------------------------------------------------------------------------------
參考:

http://msdn.microsoft.com/zh-tw/library/system.collections.specialized.namevaluecollection%28VS.80%29.aspx#Mtps_DropDownFilterText

http://hi.baidu.com/kootv/blog/item/2d474f0824d4459d0b7b8245.html

http://topic.csdn.net/t/20020915/11/1024834.html

沒有留言:

張貼留言