zoukankan      html  css  js  c++  java
  • 控件组值的取得方法

    首先 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();
                }

  • 相关阅读:
    PKUSC2021游记
    P3349 [ZJOI2016]小星星
    序二
    1.3 解析库的安装
    1.2 请求库的安装
    1.5 存储库的安装
    1.6 Web 库的安装
    1.7 App 爬取相关库的安装
    2.1 HTTP 基本原理
    1.9 部署相关库的安装
  • 原文地址:https://www.cnblogs.com/gergro/p/368820.html
Copyright © 2011-2022 走看看