Click here to Skip to main content
15,936,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Suppose this is my javascript function given below which returns current date time and some string with it
and i have to store that time and the return state as in maximized or minimized. So how to store the value of this javascript function in code behind file in
function getWindowState()
var S = window.screenLeft;
if (typeof S === 'undefined')
S = window.screenX;
S = parseInt(S);
if (S < -4000)

var t=new Date();
var curtime = t.getHours()+":"+t.getMinutes()+":"+t.getSeconds();
return "minimized";
if (S > -8 && S < 1) {
document.bgColor = "#FFFFFF";
return "maximized";

any idea how to do it with hidden control please refer the function and give me some solution please help

1 solution

suppose you have a hidden field:
<asp:hiddenfield id="HiddenFieldServerDateTime" runat="server" CssClass="SomeStyle" /></asp:hiddenfield>

You can assign the value to this hidden field like:
$("#<%= HiddenFieldServerDateTime.ClientID %>").val()="whatever you want to assign";


<pre lang="Javascript">
$("#<%= HiddenFieldServerDateTime.ClientID %>").val("value here");

Hope it helps :)
Share this answer
[no name] 6-May-14 7:21am    
the problem is my javascript function is returning a value and i have to access that value in code behind file by using whichever control. but still i m not getting it. can u please colaborate more how to achieve this using hidden field. refer function given as its returning a value.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900