zoukankan      html  css  js  c++  java
  • 后台获取js赋给服务器控件的值

         今天在后台.cs文件获取js赋给TextBox的值时,发现竟然获取不到,Text属性值竟然为空!但明明看到TextBox上已经显示有值了。最后使用隐藏域解决了问题,见下例:

       <script type="text/javascript">    

         function test()

        {

            document.getElementById("textbox1").value = document.getElementById("textbox1HF").value = "所赋的值";

        }

    </script>

        <div>

          <asp:TextBox ID="textbox1" runat="server" Enabled="false"> </asp:TextBox>

          <asp:HiddenField ID="textbox1HF" runat="server" />

       </div>

       //后台代码

       string tmp = textbox1HF.Value;//textbox1.Text获取的值为空

  • 相关阅读:
    BOZJ2200: [Usaco2011 Jan]道路和航线
    poj3662
    网络流
    最短路
    约瑟夫环
    二分图匹配
    HDU 3938 Portal
    背包dp专题训练
    noip2013day1模拟赛
    2017.10.24:lca专题系列
  • 原文地址:https://www.cnblogs.com/BensonHe/p/1780998.html
Copyright © 2011-2022 走看看