关于smartgridview在vs2008下设计视图下显示不正常的问题

在Visual Studio 2008中,将SmartGridView控件放入UpdatePanel会导致设计视图错误,表现为ID冲突且源代码无法同步。解决方案是修改SmartGridView的源代码,在OnInit方法中添加DesignMode判断,避免在设计模式下执行特定功能初始化。此问题在VS2005中未出现。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

现象:在vs2008页面设计视图下,如果smartgridview包在updatepanel中,则会出现控件错误,如出现“找到多个具有相同ID....”,同时,在设计视图修改的任何内容,在源试图都无法同步,该现象不会出现在vs2005.

 

解决方案:

    1、修改smartgridview控件源码,修改方法OnInit,增加“base.DesignMode”判断。

 

 protected override void OnInit(EventArgs e)
        {
           
if (!base.DesignMode)
            {
                this.PreRender += new EventHandler(ZoomGridView_PreRender);

                // 将需要扩展的功能对象添加到功能扩展列表里
                if (!String.IsNullOrEmpty(this._mouseOverCssClass))
                    this._efs.Add(new MouseOverCssClassFunction());

                if (!String.IsNullOrEmpty(this.BoundRowClickCommandName))
                    this._efs.Add(new RowClickFunction());

                if (!String.IsNullOrEmpty(this.BoundRowDoubleClickCommandName))
                    this._efs.Add(new RowDoubleClickFunction());


                // 遍历需要实现的功能扩展,并实现它
                foreach (ExtendFunction ef in this._efs)
                {
                    ef.ZoomGridView = this;
                    ef.Complete();
                }


                ObjectDataSource ods = this.Parent.FindControl(this.DataSourceID) as ObjectDataSource;
                if (ods != null)
                {
                    ods.Selected += new ObjectDataSourceStatusEventHandler(ods_Selected);
                }
            }

            base.OnInit(e);
        }

 

  附:转载smartgridview控件解说

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值