首先 Request.Form取回的一组控件的值安顺序用","隔开

如有5个相同name=name1 的text 通过 Request.Form["name"] 得到的值是字符串 1,2,3,4,5

我们用split函数把他转换为数组:Request.Form["name"].Split(','); 

然后我们就可以随意的处理了


下面通过一个简单的例子看一下:

          string[] arrid = Request.Form["id"].Split(',');//
          string[] arrfldname = Request.Form["fldname"].Split(',');
          string[] arrcaption = Request.Form["caption"].Split(',');
          string[] arrfldType = Request.Form["fldType"].Split(',');
          string[] arrmaxLength = Request.Form["maxLength"].Split(',');
          string[] arrrelateTbl = Request.Form["relateTbl"].Split(',');
          string[] arrrelateFld = Request.Form["relateFld"].Split(',');
          string[] arrbNull = Request.Form["bNull"].Split(',');
          for (int i = 0; i < arrid.Length; i++)
          {
             string id = arrid[i].ToString();
             string fldname =arrfldname[i].ToString();
             string caption = arrcaption[i].ToString();
             string fldType = arrfldType[i].ToString();
             string maxLength = arrmaxLength[i].ToString();
             string relateTbl = arrrelateTbl[i].ToString();
             string relateFld = arrrelateFld[i].ToString();
             string bNull = arrbNull[i].ToString();
            }

 

相关文章:

  • 2021-08-10
  • 2022-12-23
  • 2021-06-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-06
猜你喜欢
  • 2021-07-17
  • 2021-09-21
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2021-12-05
相关资源
相似解决方案