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

  • 相关阅读:
    POJ 2752 Seek the Name, Seek the Fame
    POJ 2406 Power Strings
    KMP 算法总结
    SGU 275 To xor or not to xor
    hihocoder 1196 高斯消元.二
    hihoCoder 1195 高斯消元.一
    UvaLive 5026 Building Roads
    HDU 2196 computer
    Notions of Flow Networks and Flows
    C/C++代码中的笔误
  • 原文地址:https://www.cnblogs.com/freexiaoyu/p/1378311.html
Copyright © 2011-2022 走看看