开发者

How to use a dynamically created UpdatePanel on .NET

开发者 https://www.devze.com 2023-03-18 15:58 出处:网络
I have the following code: Dim newUp As New UpdatePanel newUp.ID = \"upFlux\" Dim newLbl As New Label newLbl.ID = \"lblFlux\"

I have the following code:

Dim newUp As New UpdatePanel
newUp.ID = "upFlux"

Dim newLbl As New Label
newLbl.ID = "lblFlux"

newUp.ContentTemplateContainer.Controls.Add(newLbl)

ok, now in another part of my code (another method) i want to get this update panel and work on it. I want something like:

Dim up As new UpdatePanel("upFlux")
up.someCodeHere

what can i do?

ty in ad开发者_如何学运维vance


After you are done creating a new UpdatePanel and adding the label, you should add it to the page

Page.Controls.Add(newUp)

and later on you should be able to reference the UpdatePanel like this

Dim up as UpdatePanel = TryCast(Page.FindControl("upFlux"), UpdatePanel)
0

精彩评论

暂无评论...
验证码 换一张
取 消