My approach to solving this issue has been as follows:
I added a hidden field on the aspx page named hdnTime.
Next, I wrote a JavaScript function to assign a value to the hidden field.
<script type='text/javascript'> function getLocalTimeZone() { document.getElementById('ctl00_bcr_hdnTime').value = 10; var hidden = document.getElementById('ctl00_bcr_hdnTime'); var timezone = String(new Date()); hidden.value = timezone.substring(timezone.lastIndexOf('(') + 1).replace(')', '').trim(); }
On the C# page load, I implemented the following code.
ScriptManager.RegisterStartupScript(Page, GetType(), "disp_confirm", "getLocalTimeZone()", true); string test = hdnTime.Value;
However, I am encountering an issue where the value for hdnTime is blank.
If you have any insights or suggestions on what might be missing here, please let me know. Thank you!