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

  • 相关阅读:
    svn_linux + apache 实现网页访问svn
    SVN_2008R2 搭建流程与规范
    mysql 简称
    论运维之故障排查思路与方法
    mac pro 基本使用
    防火墙之netfailt、iptables详解
    翻转单词顺序列(剑指offer)
    中缀变为后缀
    左旋转字符串(剑指offer)
    和为S的两个数字(剑指offer)
  • 原文地址:https://www.cnblogs.com/gergro/p/368820.html
Copyright © 2011-2022 走看看