如何将同一用户控件的多个实例绑定到同一页面上的不同数据源 [英] how to bind multiple instances of same user control to different datasource on the same page

查看:116
本文介绍了如何将同一用户控件的多个实例绑定到同一页面上的不同数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个标签,每个标签包含相同用户控件(MyUC)的不同实例。现在我第一次将数据绑定到网格,它工作正常。但是在更改选项卡时,它无法将新数据重新绑定到网格。当我调试它时,我发现从数据库中获取的数据是正确的。唯一的问题在于网格绑定到该数据表。它说要使用新实例。任何帮助????

I have a 3 tabs, each tab contains different instances of the same User Control(MyUC). Now the first time I bind the data to the grid, it works fine. But on changing the tab, it fails to rebind the new data to the grid. When I debug it, I found the data fetched from database is correct. The only issue lies is when grid is bound to that datatable. It says to use the new instance. Any help????

推荐答案

您必须在该Tab上​​创建新的用户控件实例。像任何其他标准控件一样在同一页面上创建新的用户控件实例但是在不同的标签上。
You should have to create new instance of user control on that Tab.Like any other standard control create new user control instance on same page but on different Tab.


这篇关于如何将同一用户控件的多个实例绑定到同一页面上的不同数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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