Solved

Changing Textbox position on each display of webpage

Posted on 2004-08-20
4
1,810 Views
Last Modified: 2008-05-16
I have 15 controls on my webpage (textboxes, buttons, and dropdownlist).  Everytime the wepbage is displayed I want the contols to be displayed in a different position on the form.  How do I dinamically position the controls on the webpage on each display of the webpage.  I know I can use the style feature, but I do not know how to change the position from the code behind to the html.
0
Comment
Question by:Lucree
4 Comments
 

Expert Comment

by:mafrosis
ID: 11851773
Theres several ways of doing what youre trying to do - post up some of the HTML code from the .aspx page so we can see the most approriate way for you.
0
 
LVL 18

Accepted Solution

by:
DotNetLover_Baan earned 500 total points
ID: 11851803
Hi there,
just change the style attribute in your code behind... I have inside a button click...

        TextBox1.Attributes.Add("Style", "LEFT: 74px; TOP: 27px")

-Baan
0
 
LVL 25

Expert Comment

by:nauman_ahmed
ID: 11852146
Or to be more specific:

Random rnd = new Random();
TextBox1.Attributes.Add("Style",rnd.Next(10,100).ToString()+"px;Top:"+rnd.Next(15,90).ToString()+"px;");

Best, Nauman
0
 

Author Comment

by:Lucree
ID: 11853204
Your Actual Code did not work for me, but it gave me what I needed to know. This actually worked for me. Now I should be able to get it to do what I really want.

TextBox1.Attributes.Add("Style", "Z-INDEX: 106; LEFT: " & Me.TextBoxleft.Text & "px; POSITION: absolute; TOP: " & Me.TextBoxtop.Text & "px")


Thanks,
Dean
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now