【问题标题】:How to store multiple textbox values into one application variable in c#如何在c#中将多个文本框值存储到一个应用程序变量中
【发布时间】:2017-07-06 18:51:32
【问题描述】:

[code page="c#"] Hdnano.Value = Application["AccountNum"].ToString();

$(document).ready(function() {
      $("#ano").on("blur", function() {
        var accountNum = $('textarea#ano').val();
        $("#Hdnano").val(folioNum);
      });

<html>

<body>
  <form>
    <div class="container">
      <div class="row">
        <div class="col-xs-3 col-lg-2">
          SELECT bank name
        </div>
        <div class="col-xs-3 col-lg-3">
          <input id="Text1" type="text" class="form-control" />
        </div>
      </div>
      <div class="row">
        <div class="col-xs-3 col-lg-2">
          father name
        </div>
        <div class="col-xs-3 col-lg-3">
          <input id="Text1" type="text" class="form-control" />
        </div>
        <div class="col-xs-3 col-lg-2">
          father mobile no
        </div>

        <div class="col-xs-3 col-lg-3">
          <input id="Text1" type="text" class="form-control" />
        </div>
      </div>
      <div class="row">
        <div class="col-xs-3 col-lg-2">
          mother name
        </div>
        <div class="col-xs-3 col-lg-3">
          <input id="Text1" type="text" class="form-control" />
        </div>
        <div class="col-xs-3 col-lg-2">
          mother mobile no
        </div>
        <div class="col-xs-3 col-lg-3">
          <input id="Text1" type="text" class="form-control" />
        </div>
      </div>
      <div class="row">

        <div class="col-xs-3 col-lg-2">
          Account numbers
        </div>


        <div class="col-xs-3 col-md-6 col-lg-6">
          <textarea class="form-control" rows="5" id="fno"></textarea>
        </div>
      </div>
    </div>
  </form>
</body>

</html>

如何将多个文本框值存储到一个应用程序变量中? 这里的客户详细信息是选择银行名称,父亲/母亲姓名和手机号码到一个应用程序变量中,并且在文本区域中的多个帐号到第二个应用程序变量中?我想将客户的值存储到应用程序变量中,而不是想要将此值传递到与此 html 页面类似的其他页面。我如何在此处使用 json 字符串

【问题讨论】:

  • 使用哪种语言,C# 或 jQuery?
  • C#语言@Equalsk
  • 嗯,这真的取决于你以后想用它做什么,但我认为Dictionary&lt;string, string&gt; 是一个变量,其中键是文本框名称,值是文本框文本,例如key = "bank name", value = "HSBC".
  • 你能展示一下到目前为止你尝试了什么吗?

标签: c# jquery json html bootstrapping


【解决方案1】:

您可以将变量命名为数组元素。看看这个:

<form action="" method="POST">
    <input type="text" name="name1[first]">
    <input type="text" name="name1[second]">
    <input type="text" name="name1[third]">

    <input type="text" name="name2[0]">
    <input type="text" name="name2[1]">
    <input type="submit">
</form>

【讨论】:

    猜你喜欢
    • 2021-02-28
    • 1970-01-01
    • 1970-01-01
    • 2021-12-22
    • 1970-01-01
    • 1970-01-01
    • 2016-11-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多