如何从用户控件中获取所需信息......... [英] how to get required information from user control............

查看:67
本文介绍了如何从用户控件中获取所需信息.........的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人对用户控件有所了解吗?
问题是我在同一用户控件中有2个网格,但是当我从母版页调用grid1时,必须显示它,而当我从另一个Web表单中调用它时,必须显示grid2?
我正在尝试从用户控件的页面加载事件中解决它.还有其他方法可以调用它们吗?

any one have an idea of user controls?
the problem is that i have 2 grids in the same user control but when i call it from master page grid1 has to be displayed and when i call it from another web form grid2 has to be displayed?
i am trying to solve it from page load event of user control .Is there any other way to call them

推荐答案

直接的答案是将您的一个用户控件拆分为两个用户控件具有不同的网格,这更有意义.但是,如果由于某种原因您无法执行此操作,则可以在用户控件中合并两个公共布尔属性,可以从呈现用户控件的页面/母版页中设置这些属性.因此,如果要查看第一个网格,则将第一个布尔属性设置为true,将第二个布尔属性设置为false,并将这些属性用作网格的可见属性.

问候
帕旺
Straightaway answer would be to split your one user control to two user controls having different grids which makes more sense. However if for any reason you are not able to do that, then incorporate two public boolean properties in your user control, which could be set from the the page/master page where the user control is rendered. So if you want to see the first grid then set the first boolean property as true and the second one as false and use these properties for the visible property of grids.

Regards
Pawan


这篇关于如何从用户控件中获取所需信息.........的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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