By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,836 Members | 2,056 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,836 IT Pros & Developers. It's quick & easy.

Screen Resolution

P: n/a
Hi,

I'm trying to get the screen resolution of the client and to realize a
treatment in code behind.
it seem to be hard.

I can get information about the resolution with this following sub, call in
Page_Load.I fix the text of The Control Label. But no treatment is possible.
If i try to keep out the text of this label in code behind, i have nothing.
The variable is empty.

Private Sub SetScreen(ByVal ctrl As Control)
Dim sb As New System.Text.StringBuilder
sb.Append("<script language='javascript'>")
sb.Append("document.getElementById('")
sb.Append(ctrl.ClientID)
sb.Append("').innerText='Résolution : ' + screen.height + 'X' +
screen.width;")
sb.Append("</script>")
RegisterStartupScript("SetScreen", sb.ToString)
End Sub 'SetScreen

Is it possible to take the screen resolution in code behind or disable a
control web with javascript.
My goal is to refuse authentication if the resolution is not supported.

Thanks for you help.
fabrice
Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Screen resolution would be irrelevant though, unless they always ran in full
screen for their browser?

Otherwise, grab the info, set it in a hidden variable, do an autopostback,
validate, redirect to the site or to a "sorry..." page.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"fabrice" wrote:
Hi,

I'm trying to get the screen resolution of the client and to realize a
treatment in code behind.
it seem to be hard.

I can get information about the resolution with this following sub, call in
Page_Load.I fix the text of The Control Label. But no treatment is possible.
If i try to keep out the text of this label in code behind, i have nothing.
The variable is empty.

Private Sub SetScreen(ByVal ctrl As Control)
Dim sb As New System.Text.StringBuilder
sb.Append("<script language='javascript'>")
sb.Append("document.getElementById('")
sb.Append(ctrl.ClientID)
sb.Append("').innerText='Résolution : ' + screen.height + 'X' +
screen.width;")
sb.Append("</script>")
RegisterStartupScript("SetScreen", sb.ToString)
End Sub 'SetScreen

Is it possible to take the screen resolution in code behind or disable a
control web with javascript.
My goal is to refuse authentication if the resolution is not supported.

Thanks for you help.
fabrice

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.