I have a bunch panels on a page. panel1, panle2 ..., I want to make a panel visible based on a querystring. Ived tried:
Dim s As String
s = Request.QueryString("s")
Dim p As Panel = CType(Me.Controls(s), Panel)
p.Visible = True
This doesn't work. Maybe there is a whole different way to go about it. Thanks.
如果您要传递实际的面板ID(例如, http://mysite.com/page.aspx?s=panel1
://mysite.com/page.aspx?s=panel1),则应使用“ FindControl”方法:
Dim p As Panel = CType(Me.FindControl(s), Panel)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.