create button dynamic (webform)

robin1974

New member
Joined
Mar 19, 2003
Messages
3
Hello,

I want to create a button dynamic (programmatically in VB)

I can create a button in a panel dynamically in vb
but I want to place the button on a certain location in the
panel

How do I achieve this?
 
Put PlaceHolder inside the Panel, where you would want to add the Button. When you create the button, add it to PlaceHolders Controls collection

Code:
Dim objButton As New Button()
objHolder.Controls.Add(objButton)
 
ok, thanks

but I dont know in advance where the button must be placed
the coordinates of the button is variable

can this be achieved?
 
Set the CSS style attribute to reflect the top and left positions of the button.
Code:
Button1.Attributes("style") &= "position: absolute; top: 100; left: 100;"
Keep in mind this is the position of the button in its container, so to make it easier on yourself add the button to the pages control collection instead of an alternate parent element.
 

Similar threads

Back
Top