I am developing a web application which has Chart Controls. I have developed a common chart User Control to use across the application.
I am looking for an elegent way to set the Chart control’s along with other control’s width, height based on the screen(browser size).
Please help me Thanks Shaik
Sounds like you want to resize a server-side dynamic image based on a client-side value. You would first need to load the page once, use Javascript to get the screen size. (Google for that. You can get the full cross browser technical list of which Javascript elements to use at Quirksmode.org, but you’ll still need to figure out how to write the script yourself.) Then, post that size back to the server, set the control with this new size, then render it to the client as usual. Keep in mind, if the user resizes the browser window at all it won’t ‘fit’ anymore. And you can always use percentage sizes with CSS like Aaron mentioned, but then of course the browser will resize the image, which never looks that good.
Another alternative would be to put it in a Flash control. Those resize dynamically better usually, as long as the chart is rendered with vector elements by Flash.
Either way, you’ll want to make sure that this makes sense for your web design. Some times its good to make it dynamic, other times a certain amount of static size makes sense–all depends on lots of stuff, including whether or not its worth it to go to all that trouble.