How to assign JS screen.width to ASP.Net variable

Posted on 16th Feb 2014 by admin

I've got this ASP.net routine that gets the cookie value of the screen width, but now I need to change it so that it gets the width using Javascript, in case the users don't have cookies enabled. I need something like: Dim myWidth As String = ScriptManager.RegisterStartupScript(Me.Page, Me.Page.GetType, "screenwidth", "screen.width;", True) However, I get a blue line under this and it tells me that it doesn't produce a value How can I do this?

Other forums