Define exactly position an Object in webform?

 In Winform, i know method Location = new Point to define exactly position a new object ( textbox, button,....). But in webform, how can i do it?I cannot find this method?

I want to creat automatically an object when i click other object.Ex : click a button, automatically create a textbox, and i want to define exactly position of this texbox in my webform like 50,50. 

7/20/2007 2:08:10 PM 1239 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 3
Get it on Google Play
Get it on Apple App Store

Hi whamy04,

From your description, I understand that you want to dynamically create a TextBox control. In addition, the position of the TextBox control should be “top:50px and left:50px”. For this scenario, please refer to the following code.

<html xmlns="" >
<head id="Head1" runat="server">
    <title>Untitled Page</title>
    <form id="form1" runat="server">
            <asp:Button ID="Button1" runat="server" Text="Create TextBox" OnClick="Button1_Click" />
            <br />
            test test test test test test test test test test
            <br />
            test test test test test test test test test test

************** code behind
        protected void Button1_Click(object sender, EventArgs e)
            TextBox tb = new TextBox();
            tb.Style.Add("TOP", "50px");
            tb.Style.Add("LEFT", "50px");
            HtmlTextWriter myhtw = new HtmlTextWriter(new StringWriter());


Benson Yu
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help. This can be beneficial to other community members reading the thread.
7/25/2007 8:16:00 AM

Hi Benson,


I have three buttons which will display different views in my form(multiview)  Each views are displayed using buttons let say (Red, Green and Yellow)

If I click Red ,the Red form shows, If Click Green, the Green form shows. etc.

What I want to do is to create a button available to each views but will be positioned depending on the view state

For example:


I have a button called "Load Data"

If I click Red, the button "Load Data" goes to top: 50 px and left : 50 px

If I click  Green , the the button "Load Data" goes to top: 120 px and left : 60 px

If I click  Yellow , the the button "Load Data" goes to top: 100 px and left : 30 px

Please help.

Thank you



4/27/2009 6:40:57 PM

Similar Artilces:

Exact position of datawindow objects
I can get the exact position of an edit column inside a datawindow for single row. How to obtain the position of a datawindow object of one partcular row when multiple row is retrieved? ...

Not exactly .Net but definately SQL
Does anybody know how to deny server access to SQL users? (Prevent them from being able to login to enterprise manager). I know that if the user is a windows one, then you can deny them access...but why not sql users?...

Exporting/Importing webform project object
This is a multi-part message in MIME format. --------------040909080904080507010908 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> </head> <body bgcolor="#ffffff" text="#000000"> I have a webform project object that I've exported. I would like to change the "InitialCurrentDirectory" val...

VS2005: Objects change position or disappear
I would like to understand why my objects change position or disappear when I am in design view and I ask the "solutions explore" window to be showed. Furthermore, when I move this window all objects change position or disappear. I am attaching 2 screenshots to let you see this strange behaviour.Image: This is without the "Explore solutions" window.  Image1: This is what happens now. You can see a piece of image on the right and a small object (x) under it. This is just an example because sometimes also some text parts change position (from the center ...

Replace the .NET 1.1 Behavior-Object with the .NET 2.0 Tag-Object , How to?
Hello, to set the Style - Attribute of my custom controls tag in source view from within its designer i use now the following code:Behavior.SetStyleAttribute("Left", false, val, true);This works fine but my visual studio 2005 / 2.0 says that the Behavior object is obsolete. The recommended alternative is the Tag object. But when i use it to set the Style attribute it doesn't work . I can set all other attributes or even create new ones using this Tag object but it does'nt work for the style attribute at all. What am i doing wrong? If I can't set the style attribute in my custom contr...

How to open a downloaded webform project in VS.NET
I've no problem creating a new webform project or adding components to an existent one in But it's been hours I've tried to open a webform project downloaded from a vendor website and I keep on getting errors about the .shn file, project url mismatch or objects missing. What I've done is copy all the pieces into a directory and open the project from VS.NET. Do I need to create the directory name after the original project name and under c:/inetpub/wwwroot/ or anywhere? Would someone please point me the right direction? Thanks.Please mark the post(s) that have helped you as &quo...

VS.NET Projects on the Net
If I'm done with a project/solution that I created with IIS(Localhost) and VS.NET, what files from the solution will I need to upload to the host? (Host in this case is Brinkster(Free Plan)) only the aspx and ascx files ... in the bin folder you will need the compiled dll files ... Also in the root you need: web.config and flobal.asax That's itVerhoeven Bart MCSD.NET Technical Project Leader There is only 2 files in the .bin folder. ..dll file and .pdb All the ACSX and ASPX files are in the project's folder. When ever I try building the project, I get nothing in the B...

System.Net is not available in VS2005 Web project
I'm trying to access the System.Net.Mail namespace in an ASP.NET application (not website) and it's not available.  Any ideas why not? It is available in a different web site project, but not in an application. Thanks, Kahanu make sure that a reference to System.dll assembly is exists in your application.  Hosam Kamel Remember to click on Mark as answer on the post that helped you...

use VB.NET and C#.NET code in the same C#.NET project
All-- Here is a sample that is "off the beaten path", (at least for me). Is it possible, in an ASP.NET application, using the code-behind page building technique, to have both pages written in VB.NET and pages written C#.NET?At there is a sample that shows that, (contrary to popular belief), it IS possible to mix ASP.NET pages built with C#.NET with ASP.NET pages built with VB.NET in the same VS.NET 2003 project. Note that this is just a "fun" sample to see if it can be done and I do not recommend this practice as a "standard" way of develo...

How to compile a .Net/vs2003 project outside visual studio or in VS2005
I have a strange urgent issue. Our web server/web apps runs .Net 1.1 and cannot upgrade this to 2.0 or higher right away. The Project I developed is in VS2003. After moving from desktop to laptop, I am not able to install VS2003 on the laptop. Looks like this comes with 3 or 4 installations and I have used all these after getting upgraded desktops and laptops. My old desktop(s) have suddenly become unaccessable. What are my options to complete the 1.1/VS2003 apps :1. Looks like I cannot compile the web apps in VS2005.2. Is there a command line utility that I could use ?3. Any other way ?Than...

System.Net.Mail object HowTo: define message.From.DisplayName
Hi I couldn't find out how to define   "Message.From.DisplayName = a as String"   cause it's a readonly property. So how can I set it? Or maybe is it readonly for some events? Thanks in advance...Kaan ÖZGEN Hi, Consider This code System.Net.Mail.MailMessage mm = new System.Net.Mail.MailMessage();mm.From = new System.Net.Mail.MailAddress("Email Address", "Sender Name");Hope it will help you out. Thanks and best regards,Faraz Shah KhanMCP, MCAD.Net, MCSD.Net, MCTS-Win/Web, MCPD-WebBlog Hi Khan; My problem is with msg.From.DisplayName; msg.From works fine but this ...

Linq to Objects
I have a web project with a seperate class library and I am trying to use Linq to Objects within that Class Library:Private people As New List(Of Person) Public Sub doSomething()       Dim somepeople = From p In Me.people _                                   Order By pEnd SubBut evem writng the above I get an error of:"Expression of type 'System.Collection.Generic.List(Of Person)' ...

Aspose.Project 1.2 Released!
Aspose.Project 1.2 Released! Version 1.2 Released on November 15 2004 ...

Aspose.Project 1.3 Released!
Aspose.Project 1.3 Released! Version 1.3 Released on January 24 2005 Aspose.Project is a .Net Project management component which enables you to read and write...

Web resources about - Define exactly position an Object in webform? -

Gaelic football, hurling and camogie positions - Wikipedia, the free encyclopedia
The following are the positions in the Gaelic sports of Gaelic football , hurling and camogie . Like rugby and baseball , and unlike soccer , ...

Wildcare rescuers take charge as native animals find themselves in unusual positions
Wild animals who find themselves in some unusual situations are rescued by trained carers.

Analysts pile the pressure on AAPL saying company over-optimistic or “deliberately overstating” position ...
... at 9to5Mac . What do you think? Discuss "Analysts pile the pressure on AAPL saying company over-optimistic or “deliberately overstating” position" ...

Cisco Systems, Inc. (CSCO) Position Boosted by New England Research & Management
Cisco Systems, Inc. (CSCO) Position Boosted by New England Research & Management Beanstockd Cisco Systems logo New England Research & Management ...

The NBA's Top Candidate for a 2nd-Half Breakout at Every Position - Bleacher Report
When the 2014-15 NBA season began, the Utah Jazz looked like a run-of-the-mill lottery team. Some of their up-and-comers, like Gordon Hayward ...

Chris Christie’s shifting positions become fodder for his Republican opponents - The Boston Globe Chris ...
Like Mitt Romney — who was often tagged as a flip-flopper for changing his positions so many times — Chris Christie has shifted as a blue state ...

Oneida released the 'Positions' EP (stream it), announce March tour dates
Brooklyn indie rock shapeshifters Oneida released a new three-song EP, titled, Positions, at the tail end of 2015 featuring frenetic, surging ...

Bills’ Lynn to interview for Dolphins head coach position
The Buffalo Bills’ season-ending news conference Monday was long on generalities and short on specifics. For reporters sifting through nearly ...

Why Donald Trump's poll position better - Business Insider Deutschland
Donald Trump may be in a better position than most analysts predicted.

Raiders’ Mack Becomes 1st Player Ever Selected As AP All-Pro At 2 Positions
Khalil Mack became the first player in NFL history to be selected as an AP All-Pro at two seperate positions in the same season.

Resources last updated: 1/20/2016 11:08:29 AM