Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default Get Top and Left?


    I have added a control to my form in the codebehind (eg TextBox tb1 =
    new TextBox();). I now need to determine the width, CSS left, CSS top
    properties for that control so I can add label in front of it. I am
    not sure where to start. Can anyone post any helper code on how to do
    this? If this was WinForms I think I could get the TextBox coordinates
    easily, but with ASP.NET I don't understand how to do it.

    Thanks.

    xenophon Guest

  2. Similar Questions and Discussions

    1. LEFT + LEFT vs LEFT + RIGHT
      In order to do a full outer join in MySQL one must use a union. Is there any good reason to do SELECT ... LEFT JOIN UNION SELECT ......
    2. Use Unicode /Right to Left
      I want to use Arabic / Farsi in my site but I can not change the direction of Text Box to Right to Left in flash output page , Please let me...
    3. Dynamic Left to Right
      I'm using php and trying to run a dynamic table with images. The problem I'm haveing and can't figure out is, when I run the recordset, I want the...
    4. #26091 [Opn->Fbk]: left()
      ID: 26091 Updated by: moriyoshi@php.net Reported By: drei at porrigt dot se -Status: Open +Status: ...
    5. #26091 [NEW]: left()
      From: drei at porrigt dot se Operating system: Linux mini 2.4.22 PHP version: 4.3.3 PHP Bug Type: MySQL related Bug...
  3. #2

    Default RE: Get Top and Left?

    Hi Xenophon,

    Welcome to ASPNET newsgroup.
    From your description, you'd like to get a certain webcontrol's absolute
    position(top, left) on a webform so as to insert some other control
    before/after it, yes?

    As for this question, the means we can use depend on our design of the web
    application's page UI layout. Web application is quite different from
    windows application where control is located by absolute postion on form.
    In web page, generally relative postion mode is used, that means we don't
    specify absolute postion for control and use some layout control such as
    htmlTable to construct the page's main structure and fill other
    control/elements in Table cells, and we can nest tables so as to get the
    layout as we like. This makes the page's layout very flexible in case the
    browser window is resized by client user. In such scenario, if you'd like
    to dynamically add new control before existing control, I suggest you put
    that existing control inside a certain container control such as a Panel
    control(or Table control) , then find the Panel or TableCell and use
    Controls.InsertAt to add the new control before the existing control.

    If you're wanting to use absolute position in all of your web page(use the
    GridLayout in asp.net 1.x), in such mode, we can use the
    object.style.left/top script code to retrieve the absolute element's
    postion on the page, however, I don't recommend this means since it'll make
    the page's UI not quite flexible. Also, the gridlayout is canceled in the
    comming ASP.NET 2.0.

    Anyway, our suggestion is the former approach: use html table to construct
    your page's UI layout and use some sub container control to hold those
    controls whose relative postion maybe coordinated at runtime.

    Thanks,

    Steven Cheng
    Microsoft Online Support

    Get Secure! [url]www.microsoft.com/security[/url]
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)




    --------------------
    | NNTP-Posting-Date: Mon, 12 Sep 2005 22:58:29 -0500
    | From: xenophon <xenophon@online.nospam>
    | Newsgroups: microsoft.public.dotnet.framework.aspnet.buildingc ontrols
    | Subject: Get Top and Left?
    | Date: Mon, 12 Sep 2005 23:50:53 -0400
    | Message-ID: <d1jci11iqiv232ud4jbm3le7pjm45f8nc7@4ax.com>
    | X-Newsreader: Forte Agent 2.0/32.646
    | MIME-Version: 1.0
    | Content-Type: text/plain; charset=us-ascii
    | Content-Transfer-Encoding: 7bit
    | Lines: 10
    | X-Trace:
    sv3-koVxAnDmJgMiI2613kJmgzfa5kg4sTBs7vkE3u+EY9uompDM19 nl5gxnv/m2vkCEL8K66Qar
    +j3laka!oDSgozR/k4V/DXhoXOmnUeJ4bFUThMGmzbhUp1UYUzeB+O+CBc4qgB9X+bGuSE R+I+4K
    8js=
    | X-Complaints-To: [email]abuse@giganews.com[/email]
    | X-DMCA-Notifications: [url]http://www.giganews.com/info/dmca.html[/url]
    | X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
    | X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your
    complaint properly
    | X-Postfilter: 1.3.32
    | Path:
    TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfee d00.sul.t-online.de!t-onli
    ne.de!border2.nntp.dca.giganews.com!border1.nntp.d ca.giganews.com!nntp.gigan
    ews.com!local01.nntp.dca.giganews.com!news.giganew s.com.POSTED!not-for-mail
    | Xref: TK2MSFTNGXA01.phx.gbl
    microsoft.public.dotnet.framework.aspnet.buildingc ontrols:4184
    | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingc ontrols
    |
    |
    | I have added a control to my form in the codebehind (eg TextBox tb1 =
    | new TextBox();). I now need to determine the width, CSS left, CSS top
    | properties for that control so I can add label in front of it. I am
    | not sure where to start. Can anyone post any helper code on how to do
    | this? If this was WinForms I think I could get the TextBox coordinates
    | easily, but with ASP.NET I don't understand how to do it.
    |
    | Thanks.
    |
    |

    Steven Cheng[MSFT] Guest

  4. #3

    Default RE: Get Top and Left?

    Hi Xenophon,

    Have you got any progress on this issue or does the suggestions in my last
    reply helps a little? If there're any thing else we can help, please feel
    free to post here. Thanks,

    Steven Cheng
    Microsoft Online Support

    Get Secure! [url]www.microsoft.com/security[/url]
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    --------------------
    | X-Tomcat-ID: 166909542
    | References: <d1jci11iqiv232ud4jbm3le7pjm45f8nc7@4ax.com>
    | MIME-Version: 1.0
    | Content-Type: text/plain
    | Content-Transfer-Encoding: 7bit
    | From: [email]stcheng@online.microsoft.com[/email] (Steven Cheng[MSFT])
    | Organization: Microsoft
    | Date: Tue, 13 Sep 2005 08:24:03 GMT
    | Subject: RE: Get Top and Left?
    | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingc ontrols
    | Message-ID: <VLAyEyDuFHA.4068@TK2MSFTNGXA01.phx.gbl>
    | Newsgroups: microsoft.public.dotnet.framework.aspnet.buildingc ontrols
    | Lines: 95
    | Path: TK2MSFTNGXA01.phx.gbl
    | Xref: TK2MSFTNGXA01.phx.gbl
    microsoft.public.dotnet.framework.aspnet.buildingc ontrols:4186
    | NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
    |
    | Hi Xenophon,
    |
    | Welcome to ASPNET newsgroup.
    | From your description, you'd like to get a certain webcontrol's absolute
    | position(top, left) on a webform so as to insert some other control
    | before/after it, yes?
    |
    | As for this question, the means we can use depend on our design of the
    web
    | application's page UI layout. Web application is quite different from
    | windows application where control is located by absolute postion on form.
    | In web page, generally relative postion mode is used, that means we don't
    | specify absolute postion for control and use some layout control such as
    | htmlTable to construct the page's main structure and fill other
    | control/elements in Table cells, and we can nest tables so as to get the
    | layout as we like. This makes the page's layout very flexible in case the
    | browser window is resized by client user. In such scenario, if you'd
    like
    | to dynamically add new control before existing control, I suggest you put
    | that existing control inside a certain container control such as a Panel
    | control(or Table control) , then find the Panel or TableCell and use
    | Controls.InsertAt to add the new control before the existing control.
    |
    | If you're wanting to use absolute position in all of your web page(use
    the
    | GridLayout in asp.net 1.x), in such mode, we can use the
    | object.style.left/top script code to retrieve the absolute element's
    | postion on the page, however, I don't recommend this means since it'll
    make
    | the page's UI not quite flexible. Also, the gridlayout is canceled in the
    | comming ASP.NET 2.0.
    |
    | Anyway, our suggestion is the former approach: use html table to
    construct
    | your page's UI layout and use some sub container control to hold those
    | controls whose relative postion maybe coordinated at runtime.
    |
    | Thanks,
    |
    | Steven Cheng
    | Microsoft Online Support
    |
    | Get Secure! [url]www.microsoft.com/security[/url]
    | (This posting is provided "AS IS", with no warranties, and confers no
    | rights.)
    |
    |
    |
    |
    | --------------------
    | | NNTP-Posting-Date: Mon, 12 Sep 2005 22:58:29 -0500
    | | From: xenophon <xenophon@online.nospam>
    | | Newsgroups: microsoft.public.dotnet.framework.aspnet.buildingc ontrols
    | | Subject: Get Top and Left?
    | | Date: Mon, 12 Sep 2005 23:50:53 -0400
    | | Message-ID: <d1jci11iqiv232ud4jbm3le7pjm45f8nc7@4ax.com>
    | | X-Newsreader: Forte Agent 2.0/32.646
    | | MIME-Version: 1.0
    | | Content-Type: text/plain; charset=us-ascii
    | | Content-Transfer-Encoding: 7bit
    | | Lines: 10
    | | X-Trace:
    |
    sv3-koVxAnDmJgMiI2613kJmgzfa5kg4sTBs7vkE3u+EY9uompDM19 nl5gxnv/m2vkCEL8K66Qar
    |
    +j3laka!oDSgozR/k4V/DXhoXOmnUeJ4bFUThMGmzbhUp1UYUzeB+O+CBc4qgB9X+bGuSE R+I+4K
    | 8js=
    | | X-Complaints-To: [email]abuse@giganews.com[/email]
    | | X-DMCA-Notifications: [url]http://www.giganews.com/info/dmca.html[/url]
    | | X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
    | | X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your
    | complaint properly
    | | X-Postfilter: 1.3.32
    | | Path:
    |
    TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfee d00.sul.t-online.de!t-onli
    |
    ne.de!border2.nntp.dca.giganews.com!border1.nntp.d ca.giganews.com!nntp.gigan
    |
    ews.com!local01.nntp.dca.giganews.com!news.giganew s.com.POSTED!not-for-mail
    | | Xref: TK2MSFTNGXA01.phx.gbl
    | microsoft.public.dotnet.framework.aspnet.buildingc ontrols:4184
    | | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.buildingc ontrols
    | |
    | |
    | | I have added a control to my form in the codebehind (eg TextBox tb1 =
    | | new TextBox();). I now need to determine the width, CSS left, CSS top
    | | properties for that control so I can add label in front of it. I am
    | | not sure where to start. Can anyone post any helper code on how to do
    | | this? If this was WinForms I think I could get the TextBox coordinates
    | | easily, but with ASP.NET I don't understand how to do it.
    | |
    | | Thanks.
    | |
    | |
    |
    |

    Steven Cheng[MSFT] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139