locked
Horizontal and Vertical location of controls from c# code-behind RRS feed

  • Question

  • User1871582607 posted
    Label me = new Label();

    How do I set the Horizontal and Vertical position of this label. I know this is not actionscript. But in actionscript I could just go me.x = 100. Whats the equivalent in asp? Thanks

    Wednesday, March 27, 2013 11:16 AM

Answers

  • User28563431 posted
    protected void Page_Load(object sender, EventArgs e)
            {
                Label me = new Label();
                me.Text = "My Label";
                me.Attributes.Add("Style", "margin-left:200px; margin-top:400px;");
                this.Controls.Add(me);
            }

    You can set position of label control horizentally and vertically using margin property

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 27, 2013 2:25 PM