html代码如:

 

<input name="txtName"  />
<input name="txtName"  />
<input name="txtName"  /> 

服务器端读取的常规做法是:

string name = Request.Params["txtName"];

得到的将是一串以逗号分割的字符串,当然你可以手动分割:
string[] nameParts = name.Split(',');
但是当每个 input 输入可能包含逗号的时候,通过逗号分割就会是错的。
如何解决?

 

asp.net后台代码如:

 

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

 参考 晓风残月的随笔

http://www.cnblogs.com/Jinglecat/archive/2008/06/01/1211753.html

相关文章:

  • 2022-12-23
  • 2021-12-10
  • 2021-12-27
  • 2021-11-01
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2021-11-19
猜你喜欢
  • 2021-11-07
  • 2022-12-23
  • 2021-12-28
  • 2022-01-10
  • 2022-12-23
  • 2022-01-14
  • 2021-12-24
相关资源
相似解决方案