日期:2014-05-19  浏览次数:20705 次

基础问题,抢分
当一个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怎么不翻译一下贴出来呀