Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Dynamically move control.

Reply
Thread Tools

Dynamically move control.

 
 
Shawn
Guest
Posts: n/a
 
      04-05-2006
I am trying to find a way to move a button control to a location where the
mouse is clicked. I got all the code in to find the coordinates and populate
a hidden control with the values, but when I try to move the button on
postback, it moves, but to a specific place on the form everytime. Here is
where I am doing the move...

Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Init
btnLoc.Style("Position") = "Absolute"

btnLoc.Style("Top") = "25px"

btnLoc.Style("Left") = "100px"

End Sub

Any ideas???


 
Reply With Quote
 
 
 
 
Axel Dahmen
Guest
Posts: n/a
 
      04-06-2006
Hi Shawn,

are you sure you want to do this on postback? This way the user would need
for the page to be reloaded before the button appears at the new position.
Depending on the user's internet connection this might take a while...

Anyway, if you want to set a server web control's properties on postback,
you must do so in Page_Load(), not Page_Init(), because object properties
are all reset to their initial values *after* Page_Init() if the object's
EnabledViewState property is set to true.

HTH,
Axel Dahmen


----------------
"Shawn" <> schrieb im Newsbeitrag
news:#...
> I am trying to find a way to move a button control to a location where the
> mouse is clicked. I got all the code in to find the coordinates and

populate
> a hidden control with the values, but when I try to move the button on
> postback, it moves, but to a specific place on the form everytime. Here is
> where I am doing the move...
>
> Protected Sub Page_Init(ByVal sender As Object, ByVal e As

System.EventArgs)
> Handles Me.Init
> btnLoc.Style("Position") = "Absolute"
>
> btnLoc.Style("Top") = "25px"
>
> btnLoc.Style("Left") = "100px"
>
> End Sub
>
> Any ideas???
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing move constructors and move assignment Andrew Tomazos C++ 2 12-12-2011 01:45 PM
Dynamically move elements into form ? fidodido Javascript 6 12-06-2005 12:57 PM
I am trying to move spaces to a weblistbox and when I move them... Eduardo78 ASP .Net Web Controls 0 11-03-2005 06:06 PM
Load User Control Dynamically, Cast object dynamically =?Utf-8?B?UmV6YSBOYWJp?= ASP .Net 1 03-05-2005 12:04 AM
Move around a picture file dynamically in an asp page. eddie wang ASP .Net 1 07-23-2003 03:47 PM



Advertisments