How to sense changing size of control with Ajax/Javascript and using javascript affect things inside that control

I'm not much of a javascript wizard (yet) so I'm struggling here.

My scenario is I have a master page that of course has a content area.  As the content area changes size (from the user either changing the browser size or just opening) I want to get notified in javascript so I can change things inside the control itself.  Like, say for example I just want to have a circle inside the content area and I want to be able to change the position of the circle so it stays centered.

Am I clear?  If not I can explain some more.

Thanks for any help on this.


Peter Kellner
http://73rdstreet.com and blogging at
http://PeterKellner.net
MVP, ASP.NET
0
pkellner
3/26/2007 10:47:18 PM
asp.net.ajax-ui 9760 articles. 0 followers. Follow

5 Replies
971 Views

Similar Articles

[PageSpeed] 57

The scenario you describe doesn't need javascript.  If you set the width of your content area to 100%, it will expand to fill whatever space the containing element on the master pages allows.  You just need to apply text-align: center; to the content area.

Or is your requirement a bit more complex than that? 


Regards Mike
[MVP - ASP/ASP.NET]
My site
0
Mikesdotnetting
3/27/2007 10:54:04 AM

Do you mean by doing this:  (it does not seem to help)

<script type="text/javascript">

new agHost("WpfeControlHost", // DIV tag id.

"WpfeControl", // WPF/E control id.

"100%", // Width of rectangular region of WPF/E control in pixels.

"100%", // Height of rectangular region of WPF/E control in pixels.

null, // Background color of rectangular region of WPF/E control.

null, // SourceElement property value.

"Templates/EmptyTemplate.xaml", // Source property value.

"false", // WindowlessMode property value.

"30", // MaxFrameRate property value.

"onError"); // OnError property value -- notice use of single quotes.

</script>
Peter Kellner
http://73rdstreet.com and blogging at
http://PeterKellner.net
MVP, ASP.NET
0
pkellner
3/27/2007 2:49:40 PM
Is it the control you want to center?  If so, put it in a parent div and set the parent to 100% width with text-align: center; 

Regards Mike
[MVP - ASP/ASP.NET]
My site
0
Mikesdotnetting
3/27/2007 3:22:02 PM

you can add a event handler to onsize of body

<body onsize="JS_OnSize()">
...
</body>

write your JS_OnSize function

function JS_OnSize()
{
    document.getElementById("ContainerId").width .. height ...
}


Life is like a box of chocolates.
MSN/Email: lookus.cn@gmail.com
0
lookus
3/27/2007 4:53:15 PM
How could I get to onsize in a masterpage situation?
Peter Kellner
http://73rdstreet.com and blogging at
http://PeterKellner.net
MVP, ASP.NET
0
pkellner
3/27/2007 5:29:43 PM
Reply:

Similar Artilces:

Access Control inside AJAX TabContainer using Javascript
Hello! I have a DropDownList named "ApplicationList" that calls the following javascript function in its onClick event:  function SaveSelectedApp(){listApplication = document.getElementById("ApplicationList");   lastApp = listApplication.selectedIndex; } When outside of a AJAX TabContainer panel, the script runs fine.  When inside the TabContainer panel, however, I get an 'Object Required' error.  This seems to be true for any control I attempt to reference within the TabContainer panel using javascript. I also tried changing the funct...

How to instantiate an AJAX control inside a custom AJAX control
Hi I want to include a ToggleButton control inside a custom AJAX control.  How can I instantiate an instance of the ToggleButton in my Javascript?  If I create an instance of the ToggleButton in C# code, how could the Javascript pick it up?  Thank you,  ltlwinger   http://msdn.microsoft.com/en-us/library/bb397487.aspx Final Answer.Good Luck this._pin = $create(AjaxControlToolkit.ToggleButtonBehavior, { 'id': this.get_id() + "_ToggleButton", 'CheckedImageUrl': 'images/collapse.jpg', 'UncheckedImageUrl': '...

Javascript inside "web user control" not run if load "web user control" under ajax UpdatePanel
I have this problem and please if some can help me, I place here a sample code to see, but in my real problem the web user control have a very complicate javascript. I have a web user control that have some javascript inside, let say for example.1 <script type="text/javascript" > 2 function RunMe() 3 { 4 alert("Client id:<%=ClientID%>"); 5 } 6 </script> 7 8 9 <a href="javascript:RunMe()">Run javascript</a> a simple call to a simple javascript, inside the web user control And now I have...

Clicking templated controls inside <frame>/aspx/UpdatePanel/Gridview cause .net ajax javascript runtime error
I have templated controls in UpdatePanel/Gridview. Clicking the controls in regular aspx will work fine - get postback and updatepanel render fine. If I put the aspx inside frameset <frame>. Clicking controls will cause javascript runtime error - Line: 5820, Sys.ArgumentOutOfRangeException: Value must be an integer. Parameter name: x Actual value was NaN. And updatepanel does not render correctly. Does anyone have same problem, know workaround? Is there anyway to change javascript and incorporate to Web.Extensions.dll?    Sample code: **** MainEntry.aspx - <framese...

How to enable ajax (Use AJAX Controls) in my Web Control Library project
I have VS2005 with Ajax extended controls.   i have created a Web Control Library project, but i want to use ajax controls. is it possible.   I do not want to create a ajax enabled web site, but looking if any possible in my web control library project.   Please let me know and thanks in advance. D Hi, Yes. If you want to create User Control which contains a lot of web controls and Ajax control, you can create an User Control with Ajax Control to achieve it. If you want to create a Custom Control with Ajax, I suggest you build a new Extender. Please check the...

ajax.net controls used in custom composite controls?
I am creating an events calendar that uses the accordion to display the events for the selected day.  The problem I'm having is that the accordion is not responding to any client side events.  I would really like to find a good "How to" article for building composite controls that incorporate an ajax.net control like the accordion....

How well can Ajax and Javascript be used inside.Net application using C#?
In my experimentation with Ajax.Net I am not sure how far I can go with Ajax. NET and /or  javascript on the .NET platform. Is there anyone who had used these technologies exstensively who can tell me who well they can be used on .NET's platform? I guess what I am asking is...will using Ajax be like using ajax and or will using javascript be like using javascript when you use it on .NET's platform or will there be suttle diffrences?   thanks Allen    Ajax.net is basically just a javascript library like scriptaculous or others.  It has lo...

How to find Image Control inside Gridview Control using JavaScript
Hi All Can anyone tell me one thing How to find ASP Image Control inside Gridview Control using JavaScript Thanx in advance Bye and Take CareDeepak Gupta(Broadway Infotech Private Limited,Noida)Website:www.broadwayinfotech.com.auEmail-deepak.gupta@broadwayinfotech.com.auWeb Design Software Development .net Development You can try: document.images["nameOfYourControl"];JavaScript will load all the images in the document into the document.images array.  You would want to take a look at the document property.  Check out these couple articles:http://www.quirksmode.org/js...

Page and Control Flashing Using AJAX Control Toolkit Controls
Page and Control Flashing Using AJAX Control Toolkit Controls I'm using IE7 and the ASP.NET AJAX Control Toolkit.  I'm using two controls -- Accordion and CollapsiblePanelExtender.  I'm actually using 2 CollapsiblePanelExtenders, and the Accordion control is inside one of the panels for the CollapsiblePanelExtender (see the code below). The problem I'm seeing is that when I click an Accordion pane to open/close it or click the CollapsiblePanelExtender panel to open/close the panels, the controls and page flash while the animation is in progess.  Everything el...

javascript registering in user control using ajax
hi, i am using ajax to load different user control in the content area of my main page. and in my user controls oninit i am registering javascripts functions using scriptmanager.registerclientscriptblock methodi have update panel in each user controls and passing those update panel as the control arguement to the above mentioned functionieif i have an update panel upOne in my user control one in it's on init event i am usingscriptmanager.registerclientscriptblock(upOne,upOne.gettype(),"Demoscript","Submitme()" ,true);my question is since i am loading different user...

Leveraging Ajax Control Toolkit Javascript without Server-side controls
Alright, here's a question that I have not seen anybody talk about before ... I'm writing a web app that needs to create an Accordion control dynamically (adding/removing accordion panes on the fly). I don't want to have a bunch of ajax UpdatePanel updates on the page - in my opinion they are way too clunky for my taste. Regardless, it'd be much easier and faster if I was able to add/remove the panels using my own javascript code, and at the same time leveraging a lot of the javascript already built for various ajax toolkit controls. Does anyone have...

Non-Ajax Javascript (using window.setInterval) is changed when I do an Ajax call back
The time set using window.setInterval (on page load) is changed when I do a call backI have this code which writes tickertape across the screen using javascript. Every 75ms it is supposed to write a banner character, giving the effect of tickertape. When it's finished writing characters it stops (for a while). Then it moves to the next banner. There are 3 banners (which are latest news headlines).The problem is that when I do a call back the interval of 75ms seems to halve. From 75ms, to 38ms, to 19ms; halving with each callback. This is unfortunate as the page has a sortable GridView in...

How to access ServerSide control Value in Javascript changed by Ajax
Hello,I have a Textbox whose value is been changed using ServerSide code (AJAX based - Partial postback) and now I want to access that changed value in JavaScript. Please suggest me that how can I access that value.document.getElementByID is displaying old value.Things work fine with full postback but are creating above issue with Partial Postback.Thanks, in Advance.... Code till Death... Even it is partial postback the value will be rendered with the new one if you are rendering the control back...  What do you mean by "Partial postback" ? Is it an update panel? Do you ca...

Error in using Javascript code along with AJAX Control Toolkit.
I am making use of AJAX control toolkit in my website...But the controls where i have used javascript null value validations and ajax controls together ; at such places my javascript code is not fired... can some one tell me the reason for this ? Satpal, There's no way to tell what is going on unless you post some of your code.  If you do, I'm sure someone will be able to help you out. JamesJames Ashley, Magenic Technologies(james.ashley.magenic@gmail.com)...

Web resources about - How to sense changing size of control with Ajax/Javascript and using javascript affect things inside that control - asp.net.ajax-ui

JavaScript Kit- Your comprehensive JavaScript, DHTML, CSS, and Ajax stop
Your comprehensive JavaScript, DHTML, CSS, and Ajax stop

Let's Code: Test-Driven Javascript by James Shore — Kickstarter
James Shore is raising funds for Let's Code: Test-Driven Javascript on Kickstarter! A screencast series focusing on rigorous, professional Javascript ...

Eloquent JavaScript: A Modern Introduction to Programming
... and pragmatics. I loved the tutorial-style game-like program development. This book rekindled my earliest joys of programming. Plus, JavaScript! ...

Lightbox (JavaScript) - Wikipedia, the free encyclopedia
On a Lightbox-enabled page, a user can click an image to have it magnified in a Lightbox window, which resizes itself according to the size of ...

Open Directory - Computers: Programming: Languages: JavaScript: Tools: Obfuscators
about dmoz - help Top : Computers : Programming : Languages : JavaScript : Tools : Obfuscators Tools for obfuscation/compression JavaScript code. ...

Facebook Open-Sources JavaScript Static-Type Checker Flow
The latest software to be open-sourced by Facebook is Flow , a static-type checker for JavaScript . (more…) New Career Opportunities Daily: ...

Under the Hood: The JavaScript SDK - The use of polyfills - Facebook
Facebook Engineering hat eine Notiz mit dem Titel Under the Hood: The JavaScript SDK - The use of polyfills geschrieben. Du kannst den vollständigen ...

Quickstart: Facebook SDK for JavaScript
This quickstart will show you how to setup the SDK, load social plugins, trigger a dialog, and get it to make some basic Graph API calls.

Facebook App Devs Get Javascript
It has been an oft-lamented fact of the Facebook Platform thus far in its life that, in order to use all but the most simple of Javascript functionality–the ...

Badass JavaScript (@badass_js) on Twitter
WebGLWorker is an open source library that allows using WebGL from Web Workers. Great work as always from @kripken . blog.mozilla.org/research/2014/… ...

Resources last updated: 1/12/2016 6:48:26 AM