473,597 Members | 2,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Obtaining a ASP.NET Control's Location within the code behind class

Hello,

I am bringing up an iFrame with a calendar control in it in
coordination with a text box that holds a date field. In my code
behind class I add a method call to the text box's OnFocus event that
calls the javascript method that shows and positions the iFrame
(arguments are the text control, and the desired x and y coordinates of
the iFrame). Right now I use hardcoded fixed values for the calendar
location - it was expedient and it worked - but I would prefer to
dynamically locate the iFrame based on the location of the text box
that holds the date.

I could do this in my current scenario if I could obtain the x and y
coordinate of the text box within the code behind class (the page is
Flow Layout, not Grid Layout). I have not been able to figure out how
to obtain these coordinates.

Does anyone know a way of obtaining the x and y coordinates of a
ASP.NET text box from the code behind class?
Thanks,
Biff Gaut
Gaithersburg, MD

Nov 19 '05 #1
3 3053
"Biff" <bi*******@hotm ail.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Hello,

I am bringing up an iFrame with a calendar control in it in
coordination with a text box that holds a date field. In my code
behind class I add a method call to the text box's OnFocus event that
calls the javascript method that shows and positions the iFrame
(arguments are the text control, and the desired x and y coordinates of
the iFrame). Right now I use hardcoded fixed values for the calendar
location - it was expedient and it worked - but I would prefer to
dynamically locate the iFrame based on the location of the text box
that holds the date.

I could do this in my current scenario if I could obtain the x and y
coordinate of the text box within the code behind class (the page is
Flow Layout, not Grid Layout). I have not been able to figure out how
to obtain these coordinates.

Does anyone know a way of obtaining the x and y coordinates of a
ASP.NET text box from the code behind class?


Server-side controls do not have x and y coordinates.

John Saunders
Nov 19 '05 #2
Biff,

You should pass the coordinates from client to server. The most common way
of passing information that way is using hidden <input> elements.

Eliyahu

"Biff" <bi*******@hotm ail.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Hello,

I am bringing up an iFrame with a calendar control in it in
coordination with a text box that holds a date field. In my code
behind class I add a method call to the text box's OnFocus event that
calls the javascript method that shows and positions the iFrame
(arguments are the text control, and the desired x and y coordinates of
the iFrame). Right now I use hardcoded fixed values for the calendar
location - it was expedient and it worked - but I would prefer to
dynamically locate the iFrame based on the location of the text box
that holds the date.

I could do this in my current scenario if I could obtain the x and y
coordinate of the text box within the code behind class (the page is
Flow Layout, not Grid Layout). I have not been able to figure out how
to obtain these coordinates.

Does anyone know a way of obtaining the x and y coordinates of a
ASP.NET text box from the code behind class?
Thanks,
Biff Gaut
Gaithersburg, MD

Nov 19 '05 #3
That's an interesting concept, I'll look into that.

Thanks,
Biff

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
2069
by: Will Pittenger | last post by:
I have a Control derived class. When the parent of the control changes the control's Location property, the stack overflows. I have not found a way to find out what was on the stack when it does overflow. All I know is that the program is either stopped due to an exception at the end of Main or has exited after the Stack Overflow exception. (Both cases are Debug builds running in the debugger.) After a lot of trial and error (mostly...
2
13724
by: adiel | last post by:
Hello, I am trying to access the properties and methods from a user control within the code-behind file for a webform but I am receiving the message: Name 'MenuBar1' is not declared It does not recognize the user control in the code behind... Here is the code for the user control: MenuBar.ascx:
1
11026
by: Earl Teigrob | last post by:
I am creating an web control within a class and instance the class within my code behind and use its methods to dynamically generate page contents. The problem is that I need to be able to capture the events to the web control from within the code behind of the containing page. How do I do this? I have created custom controls and bubbled events before. I have also dynamically created web controls with the code behind and hard wired the...
6
11274
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header" Src="WebControls/Header.ascx" %> The web user control contains the following server controls
2
3613
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
20
5616
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just client-side HTML, CSS, etc. What I want to do is somehow insert a *server control* into the , then set the server control's properties at runtime.
0
2458
by: Matthew | last post by:
All, I have searched google and the newsgroups but can't find anything the same as what I am experiencing (though I may have missed something). I have controls (textboxes) within UserControls which are not behaving as I would expect. Specifically, if there is a command button external to the usercontrol which is activated by a shortcut key (eg Alt-B), the command button Click event handler code 'executes' even though the textbox set...
0
1902
by: Brian Henry | last post by:
Ok I've never implemented a snap location before so I dont really know what im doing wrong here... anyways, I am making a custom slider control that takes dates as its values instead of integers... then taking that date range and finding dates specifiec between them (in a list of dates) and putting snap marks, so if you slide it near one of them it should snap to that tick, but that part i cant figure out. the rest seems ok so far... here...
2
4809
by: rn5a | last post by:
Assume that a user control (MyUC.ascx) encapsulates 2 TextBoxes with the IDs 'txt1' & 'txt2' respectively. To use this user control in an ASPX page, the following Register directive will be required: <%@ Register TagPrefix="UC" TagName="MyUserCtrl" Src="MyUC.ascx" %> Assuming that the ASPX page doesn't use a code-behind, I can access the properties, events etc. of the user control in the ASPX page in this way (assume that the ASPX page...
0
7965
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7885
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8271
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6686
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3923
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2399
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1231
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.