如何使用c#刷新asp.net中的gridiview [英] how to refresh the gridiview in asp.net using c#

查看:72
本文介绍了如何使用c#刷新asp.net中的gridiview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我点击Show按钮时,从房间表中,在Gridview中记录如下





room1 course1 room2 course2



11 AFF 21 MFA

12 EFA 22 ROC

13 23 ERS ​​

14 SFU 24 ASM





然后我点击保存按钮时保存按钮记录保存在分配表中。





分配表记录如下



room1 course1 room2 course2



11 AFF 21 MFA

12 EFA 22 ROC

13 POL 23 ERS ​​

14 SFU 24 ASM



然后我有一个名为刷新gridview的按钮,当我从分配表中点击gridview记录中的刷新gridview按钮时





终于在gridview记录中如下





11 AFF 21 MFA

12 EFA 22 ROC

13 POL 23 ERS ​​

14 SFU 24 ASM



当我点击刷新gridview错误时显示如下



一个名为'Room1'的字段或属性在所选数据源中找不到。





我该怎么办?



请帮帮我。



Rgds,

Narasiman P.

when i click the Show button, from the room table,In Gridview records as follows


room1 course1 room2 course2

11 AFF 21 MFA
12 EFA 22 ROC
13 23 ERS
14 SFU 24 ASM


Then i have save button when i click the save button records are saved in the Allocation Table.


The Allocation Table records as follows

room1 course1 room2 course2

11 AFF 21 MFA
12 EFA 22 ROC
13 POL 23 ERS
14 SFU 24 ASM

Then i have one button called Refresh gridview, when i click that refresh gridview button in gridview records as follows from the allocation table


finally in gridview records as follows


11 AFF 21 MFA
12 EFA 22 ROC
13 POL 23 ERS
14 SFU 24 ASM

when i click the refresh gridview error shows as follows

A field or property with the name 'Room1' was not found on the selected data source.


what can i do?

please help me.

Rgds,
Narasiman P.

推荐答案

看一下这篇文章。他们正在做你想做的事情。他们在updatepanel中使用gridview并使用AJAX Timer Control每30秒刷新一次。



点击这里
take a look at this article. they are exactly doing the same thing you are trying to do. they have gridview in updatepanel and refreshing it every 30 seconds using AJAX Timer Control.

Click Here


我想你应该将datagridview的AutoGenerateColumns属性设置为true。然后,datagrid将显示DataSource中返回的所有列,您将能够看到正在发生的事情。
I guess you should set the AutoGenerateColumns property of your datagridview to true. Then, the datagrid will show all the columns from the DataSource as they are returned and you will be able to see what is going on.


这篇关于如何使用c#刷新asp.net中的gridiview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆