Dynamically position custom control .ascx

G

Guest

Hi I have a custom control and am using as a menu on webpages, just wondering
if there is a way to position it differently on different pages, perhaps some
code in the page load event?
thanks,
 
G

Guest

Hi I am having trouble accessing the styles attribute of the control, tried
the following but it does not work. navbar.ascx is the custom control
Dim myControl As navbar = CType(Page.LoadControl("navbar.ascx"), navbar)
myControl.styles---not recognized
--
Paul G
Software engineer.


Ibrahim ULUDAG said:
You can use style to change the postion.

MyControl.styles.Add("position","absolute")
MyControl.styles.Add("top","20")

Ibrahim ULUDAG
www.ibrahimuludag.com
 
I

Ibrahim ULUDAG

Or try

MyControl.Attributes.Add("style","position:absolute;top:20px");

I hope i works.

Ibrahim ULUDAG
www.ibrahimuludag.com

Paul said:
Hi I am having trouble accessing the styles attribute of the control,
tried
the following but it does not work. navbar.ascx is the custom control
Dim myControl As navbar = CType(Page.LoadControl("navbar.ascx"), navbar)
myControl.styles---not recognized
 
G

Guest

Hi it builds and runs ok but does not seem to move the control around.
Here is what I have.
Dim myControl As navbar = CType(Page.LoadControl("navbar.ascx"), navbar)
myControl.Attributes.Add("style", "position:absolute;left:40px")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top