• js 服务器端控件赋值


    <%@ Import Namespace="System.Data" %>

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

     

    <script type="text/javascript">

    function onClickReg()

    {

      document.getElementById("<%=hfOrdinaryType.ClientID%>").value=type.toString();

    }
    </script>

     

    <!--ajax-->

    web.config

    <httpHandlers>

            <add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax"/>
    </httpHandlers>

    <script type="text/javascript">

    function onClickReg()

    {

      Soft_NewGroup.SetHfType(1,type);

    }
    </script>

    public partial class Soft_NewGroup : WebBasePage
    {

    protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                //注册Ajax类型
                Ajax.Utility.RegisterTypeForAjax(typeof(Soft_NewGroup));
            }
     
        }

    [Ajax.AjaxMethod()]
        public void SetHfType(int id,int iType)
        {
            if (id == 1)
                hfOrdinaryType.Value = iType.ToString();
            else if (id == 2)
                hfSpontaneousType.Value = iType.ToString();
            else
                hfFixedType.Value = iType.ToString();
        }

    }

  • 相关阅读:
    SQL SERVER列转换行及UNPIVOT
    25.元素,元素内容和元素属性 Walker
    16.开发工具介绍 Walker
    13.前后端程序浅解 Walker
    21.创建标准的html文件 Walker
    15.html和html5 Walker
    24.代码注释 Walker
    22.文档的基本结构 Walker
    23.单标签和双标签 Walker
    26.代码书写规范 Walker
  • 原文地址:https://www.cnblogs.com/xsmhero/p/1756474.html
Copyright © 2020-2023  润新知