|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Dynamically move control.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??? 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 ---------------- Show quoteHide quote "Shawn" <shawn.cam***@ccci.org> schrieb im Newsbeitrag news:#TFwJTMWGHA.3332@TK2MSFTNGP02.phx.gbl... > 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??? > >
"Cannot have multiple items selected in a DropDownList" Error
edit attribute values of a web control just before control rendered to the page (control's Load even events inheritance RE: Checkbox data binding on Checked property Accessing FormView template controls clicked event never fires Atlas UpdatePanel with Webparts validating user control Problems with dynamically created GridView/DetailsView How to reach the object connected to repeater |
|||||||||||||||||||||||