CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2007
    Location
    South Africa
    Posts
    263

    How to Find the Position of a Textbox in a Page in Asp.net C#

    Good Day All

    I have a Dynaically created a Textbox and i have a Dynamically created DIV. So what i want to do is to Find the Position of the Textbox and and Dynamically when this textbox is created , please a Div just next to this textbox. So my plan was to find the position of the textbox and next to it using the position of the textbox and calculate the position of a Div.



    Thanks
    Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."

  2. #2
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: How to Find the Position of a Textbox in a Page in Asp.net C#

    hmm ..

    Shot in the dark here as i'm not too sure how possible it is to do what your asking... because as the page renders alot of objects do move around, and also on different browsers they may land in different locations, And also many now have a zoom function, that reRenders the page with new font & Image sizes...

    So why not place both the Textbox and Div inside a Panel or Div and then place that of the page..

    IE:

    Dynamically create a Div, Place it where you want the textbox.
    add the Textbox to the Div..
    Add your other Div next to the Textbox in the First Div..

    Some experimenting may be needed here to find the exact right Initial holder, however i see no problem using a Div..
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  3. #3
    Join Date
    Dec 2007
    Location
    South Africa
    Posts
    263

    Re: How to Find the Position of a Textbox in a Page in Asp.net C#

    i have created a Div Dynamically


    Code:
     Dim CoverDiv As New System.Web.UI.HtmlControls.HtmlGenericControl("DIV")
                Me.Controls.Add(CoverDiv)
    
                Dim CoverDiv2 As New System.Web.UI.HtmlControls.HtmlGenericControl("DIV")
                Me.Controls.Add(CoverDiv2)
    and added a textbox(cnt) to a new div "CoverDiv" and added the Main div that i want to show next to the textbox in another div that i just created.

    Code:
                CoverDiv.Controls.Add(cnt)
                CoverDiv2.Controls.Add(Maindiv)
    so but the "Maindiv" still appear at the bottom of the page

    Thanks
    Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."

  4. #4
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: How to Find the Position of a Textbox in a Page in Asp.net C#

    Try it this way ...
    Code:
                Dim CoverDiv As New System.Web.UI.HtmlControls.HtmlGenericControl("DIV")
                Me.Controls.Add(CoverDiv)
    
                CoverDiv.Controls.Add(cnt)
                CoverDiv.Controls.Add(Maindiv)
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured