首页 新闻 搜索 专区 学院

WeifenLuo.Docking框架是不是有问题啊,绑定数据后不显示

0
悬赏园豆:15 [已关闭问题] 关闭于 2013-07-30 09:16

代码附上: 

void UCHouseholdRegisterInfoList_Load(object sender, EventArgs e)
        {
            BusinessService.CommunityBasicInfo.HouseholdRegisterInfoService service = new BusinessService.CommunityBasicInfo.HouseholdRegisterInfoService();
            IList<Tc_ge_rpr> householdInfoList= service.GetHouseholdRegisterInfoList();
            this.dgvHouseholdRegisterInfo.DataSource = householdInfoList;
            UIHelper.AddIndexToView(dgvHouseholdRegisterInfo);
        }

UIHelper方法如下

        /// <summary>
        /// 向datagridview添加自动编号
        /// </summary>
        /// <param name="view"></param>
        public static void AddIndexToView(DataGridView view)
        {
            try
            {
                view.Columns.Add(new DataGridViewTextBoxColumn() {Name = "dataGridviewIndex", HeaderText= "编号" });
                view.Columns["dataGridviewIndex"].DisplayIndex = 0;
                for (int i = 0; i < view.Rows.Count; i++)
                {
                    view.Rows[i].Cells["dataGridviewIndex"].Value = i + 1;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

我在普通的form里试验过没有任何问题,但是在WeifenLuo继承过来的窗体里就不会显示,但是如果在按钮事件里添加又可以,不知道是什么原因,我觉得不是加载事件顺序不对,因为普通的Form可以实现,哪位高手遇到过这种问题,给予帮助

蝶殇的主页 蝶殇 | 初学一级 | 园豆:32
提问于:2012-03-22 09:41
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册