MyException - 我的异常网
当前位置:我的异常网» C# » 基础有关问题,抢分

基础有关问题,抢分

www.MyException.Cn  网友分享于:2013-12-22  浏览:2次
基础问题,抢分
当一个WebControl放入LoginView后,如何获得这个对象?
比如
((GridView)(Loginview.FindControl( "GridView1 ")))
返回的似乎是个空。

------解决方案--------------------
Control myControl = FindControl( "GridView1 ");
先试试看这个是不是为空
------解决方案--------------------
LoginView的什么模版里?
------解决方案--------------------
For the LoginView control, when being added onto a page, at a certain time,
only one Template (anonymous or loggedIn ) is applied on the Control
instance, so at that time, we can only retrieve the reference of those
controls in the active template( can 't access those in the non-active
template). So you can first determine whether the user has been
authenticated or not and then use the LoginView.FindControl( stringId)
together with the sub control 's ID to retrieve the control reference.

MS新闻组的解释
------解决方案--------------------
LS怎么不翻译一下贴出来呀

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有