Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在一个页面上有一堆面板。panel1,panle2 ...,我想根据查询字符串使面板可见。艾维尝试过:
Dim s As String s = Request.QueryString("s") Dim p As Panel = CType(Me.Controls(s), Panel) p.Visible = True
这行不通。也许有一种完全不同的方式来解决它。谢谢。
如果您传递实际的面板 ID(例如http://mysite.com/page.aspx?s=panel1),您应该使用“FindControl”方法:
http://mysite.com/page.aspx?s=panel1
Dim p As Panel = CType(Me.FindControl(s), Panel)