找回密码
 立即注册

QQ登录

只需一步,快速开始

vbagcl

初级会员

24

主题

100

帖子

210

积分

初级会员

积分
210

活字格认证微信认证勋章

[已处理] 数据刷新问题

vbagcl
初级会员   /  发表于:2012-5-4 16:01  /   查看:11017  /  回复:5
我在前台定义一个C1GRIDVIEW,

<cc1:C1GridView ID="T1" runat="server"
                UseEmbeddedVisualStyles="True"
                VisualStyle="Vista"  >
            </cc1:C1GridView>  

然后在后台进行动态生成C1GRIDVIEW:
C1GridViewRow tr = new C1GridViewRow(C1_table.Rows.Count, 0, C1GridViewRowType.DataRow, C1GridViewRowState.Normal);

tr.Cells.Add(new myTableCell)

C1_table.Controls[0].Controls.AddAt(C1_table.Controls[0].Controls.Count - 1, tr);

C1_table是从前台传递到后台的C1GRIDVIEW。
我做过时间跟踪,有一个画面,查询数据库的时间是6秒,动态生成C1GRIDVIEW的时间是1秒,而前台显示的时间总共需要110秒。
不知道问题出在哪里,请指导!
多谢!

5 个回复

倒序浏览
iceman
社区贡献组   /  发表于:2012-5-4 17:29:00
沙发

回复 1# vbagcl 的帖子

vbagcl 你好,
通过楼主的描述,请问楼主的数据量是多少呢?
如果数据量过多的话,建议楼主使用 C1GridView 分页功能,每次查询部分数据。
回复 使用道具 举报
vbagcl
初级会员   /  发表于:2012-5-4 20:24:00
板凳
我已经对每次查询的行数进行限制,每次查询最多200行。我上面所说的时间就是200所需要的时间。
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-5-7 14:27:00
地板

回复 3# vbagcl 的帖子

vbagcl 你好,
我使用下列代码绑定数据耗时 3 秒,请楼主参考:

  1. protected void Page_Load(object sender, EventArgs e)
  2.         {
  3.             DataTable test = new DataTable();
  4.             test.Columns.Add(&quot;列一&quot;, typeof(System.Int16));
  5.             test.Columns.Add(&quot;列二&quot;, typeof(System.Int16));
  6.             test.Columns.Add(&quot;列三&quot;, typeof(System.Int16));
  7.             test.Columns.Add(&quot;列四&quot;, typeof(System.Int16));
  8.             test.Columns.Add(&quot;列五&quot;, typeof(System.Int16));
  9.             test.Columns.Add(&quot;列六&quot;, typeof(System.Int16));
  10.             test.Columns.Add(&quot;列七&quot;, typeof(System.Int16));
  11.             test.Columns.Add(&quot;列八&quot;, typeof(System.Int16));

  12.             for (int i = 0; i &lt; 1000; i++)
  13.             {
  14.                 test.Rows.Add(i,i,i,i,i,i,i,i);
  15.             }

  16.             this.C1GridView1.AllowPaging = true;
  17.             this.C1GridView1.PageSize = 200;
  18.             this.C1GridView1.DataSource = test;
  19.             this.C1GridView1.DataBind();
复制代码

所以没有重现问题,建议楼主发 Demo 到论坛调试。
回复 使用道具 举报
vbagcl
初级会员   /  发表于:2012-5-12 18:31:00
5#
多谢指导,我知道这样做是很快,但是对C1GridView1采用动态生成行及列,就很慢,进行时间跟踪时好像不是动态生成行及列慢,而是动态生成后在前台显示慢。
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-5-14 16:00:00
6#

回复 5# vbagcl 的帖子

vbagcl 你好,
感谢楼主的配合,能否请楼主发个 Demo 到论坛调试?
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部