This is from Stack Overflow, sorry for the copy-paste.
I have a dashboard web application. It contains some controls on it which are sized based on the browser and are also resizeable by the user. They are dynamically created and, as such, I persist their dimensions through page postbacks by storing their state in Session and in a database.
When my dashboard first loads there is a chance that I am pulling data out of the Database onto a monitor which is not the same size as when the data was written to the Database. The controls need to be resized proportional to how they were before. Fortunately, it appears that the controls are able to resize themselves to the correct, proportional dimensions if they believe they need to re-calculate their dimensions.
As such, on first page load, I would like to simulate the browser resizing. Is it possible to do something like this in javascript?
So, what I've done is this:
protected
void
Page_Load(
object
sender, EventArgs e)
{
RegenerationManager.Instance.RegenerateDockContents();
//Reload controls once to have them auto-detect browser settings.
if
(!IsPostBack) ScriptManager.RegisterStartupScript(Page, Page.GetType(),
"KEY01"
,
"ForceResize();"
,
true
);
}
function
ForceResize() {
setTimeout(
function
() {
window.onresize =
function
() { alert(
'Thanks, its resized!!'
); };
$(window).resize();
}, 100);
}
That is to say, I have OnClientResizing events for some RadPanes. These events do not fire when I call browser resize. What are they bound to?
I have tried forcing a postback on the RadPanes parent splitter. This does not seem to be sufficient enough to cause them to adjust their dimensions appropriately.
Thoughts?