So in my page load I have registered the Javacsript and that all works fine. Then on my button click I can get the result and assign it to the asp control no problems. All works fine.
My drama is that when I go to use this in my project which uses Master pages it all turns to crap.
I've been over it and over it and while I realise its something to do with the Master Page I can't get it to work. I've put the code in my ASPX page that is using the MasterPage, and I've tried it in the MasterPage and I've tried it in both. My code for the .aspx pages that work fine is below. If someone can give me any idea of how this will work in a Master page setup I will be EXTREMELY grateful.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="JSTest.aspx.cs" Inherits="JSTest" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<form id="form1" runat="server">
<asp:Label ID="lblText" runat="server"></asp:Label>
<input type="hidden" id="hdClient" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
ASPX Code Behind:
protected void Page_Load(object sender, EventArgs e)
"var offset = now.getTimezoneOffset(); document.forms.hdClient.value = -offset} </script>");
ClientScriptManager manager = Page.ClientScript;
manager.RegisterStartupScript(this.GetType(), "SetDate", "doDateCalcs();", true);
protected void Button1_Click(object sender, EventArgs e)
lblText.Text = DateTime.Now.ToUniversalTime().AddMinutes(double.Parse(Request.Form["hdClient"])).ToString();
DateTime clientsDate = DateTime.Parse(lblText.Text);