At its simplest
var width = $(window).width();
var height = $(window).height();
Complete method using hidden form inputs
Assuming you have: JQuery framework.
First, add these hidden form inputs to store the width and height until postback.
Next we want to get the window (viewport) width and height. JQuery has two methods for this, aptly named width() and height().
Add the following code to your .aspx file within the head element.
This will result in the width and height of the browser window being available on postback. Just access the hidden form inputs like this:
var TheBrowserWidth = width.Value;
var TheBrowserHeight = height.Value;
Note on UpdatePanels: If you are posting back via UpdatePanels, I believe the hidden inputs need to be within the UpdatePanel.
Alternatively you can post back the values via an ajax call. This is useful if you want to react to window resizing.