zoukankan      html  css  js  c++  java
  • <asp:HiddenField> 控件 实现键值对保存

    前台:

        <asp:HiddenField ID="HfContacts" runat="server" Value="" />

       var item = { name: _name, tel: _tel };
                    contacts.push(item);
                    $("#HfContacts").val(JSON.stringify(contacts));

    后台:

     [DataContract]
        class Contact
        {
            [DataMember]
            public string name { get; set; }
            [DataMember]
            public string tel { get; set; }

        }

       //保存联系方式
                        Dictionary<string, string> wayContact = new Dictionary<string, string>();
                        List<Contact> contacts = BaiKeTool.SerializationHelper.JsonDeserialize<List<Contact>>(HfContacts.Value);
                        foreach (var item in contacts)
                        {
                            wayContact.Add(item.name, item.tel);
                        }

  • 相关阅读:
    APP支付,后台支付宝生成预支付设置超时时间timeout_express无效,使用time_expire代替
    一些学习资料
    自连接
    模型成员
    模型查询
    模板
    管理站点
    视图
    设计模型
    搭建开发环境
  • 原文地址:https://www.cnblogs.com/Mancy/p/3298750.html
Copyright © 2011-2022 走看看