Exemplo n.º 1
0
        /// <summary>
        /// 取得表单数据
        /// </summary>
        public static void GetForm <T>(Page Ucontrol, T entity, string prefix)
        {
            foreach (PropertyInfo p in typeof(T).GetProperties())
            {
                Control ctrl = FindControl(Ucontrol, prefix + p.Name);

                if (ctrl != null)
                {
                    object value = WebControlValue.GetValue(ctrl);
                    SetPropertyValue <T>(p, value.ToString(), entity);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 取得表单数据
        /// </summary>
        public static void GetForm <T>(UserControl Ucontrol, T entity, string prefix)
        {
            foreach (PropertyInfo p in typeof(T).GetProperties())
            {
                Control ctrl = Ucontrol.FindControl(prefix + p.Name);

                if (ctrl != null)
                {
                    //Trace.Write(" not null ,type = "+ ctrl.GetType().Name);
                    object value = WebControlValue.GetValue(ctrl);
                    SetPropertyValue <T>(p, value.ToString(), entity);
                }
                //Trace.WriteLine("");
            }
        }