How can I input x and y values into my TextBox? I tried the following code but it doesn't seem to work.
<script language="javascript" type="text/javaScript">
function ScreenResolution()
{
var x = screen.width.toString();
var y = screen.height.toString();
var xx = document.getElementById("HiddenField1");
var yy = document.getElementById("HiddenField2");
xx.value = x;
yy.value = y;
}
</script>
Here is my asp.net code:
<asp:HiddenField ID="HiddenField1" runat="server" />
<asp:HiddenField ID="HiddenField2" runat="server" />
This is the C# code:
protected void Page_Load(object sender, EventArgs e)
{
string script = "<script language='javascript'> ScreenResolution(); </script> ";
ClientScript.RegisterStartupScript(this.GetType(), "ScreenResolution();", script);
TextBox1.Text = HiddenField1.Value.ToString() + "x" + HiddenField2.Value.ToString();// Issue here**
}