zoukankan      html  css  js  c++  java
  • 后台得到HTML控件值

     第一种方法:

    前台

    <div>
            <select id="Select1" name="sel">
                <option selected="selected" value="1">1</option>
                 <option selected="selected" value="2">2</option>
                  <option selected="selected" value="3">3</option>
                   <option selected="selected" value="4">4</option>
                   <option selected="selected" value="5">5</option>
                   <option selected="selected" value="6">6</option>
            </select>
            <input id="Text1" type="text" name="Text1"/>       
            <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></div>

    后台

      Response.Write(Request.Form["sel"].ToString()+"<br>");
            Response.Write(Request.Form["Text1"].ToString());

    第二种方法:  ajaxpro

    前台

    function Addint()
         {
           var tb1=document.getElementById('TextBox1').value;
           var tb2=document.getElementById('TextBox2').value;
           document.getElementById('TextBox3').value = ajaxSum.AddTwo(tb1,tb2).value;
         }

    后台

     [AjaxPro.AjaxMethod]
        public string AddTwo(int firstInt, int secondInt)
        {
            return Convert.ToString(firstInt+secondInt);
        }

  • 相关阅读:
    sql中常用sql语句
    MVC中将list<>转化成json 并处理时间格式
    html echarts做统计图
    sql存储过程如何将1,2,3这种字符做批量操作
    .net中将 list<> 转换成string类型(1,2,3)
    asp.net中导出Excel通用型
    javaScript 比较时间
    javaScript从数组里随机抽取10个不重复的值
    Git 常用命令
    jQuery关键词高亮
  • 原文地址:https://www.cnblogs.com/freexiaoyu/p/1378311.html
Copyright © 2011-2022 走看看