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 vb.net
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 asp.net hidden control please refer the function and give me some solution please help
Posted

1 solution

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


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


OR

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


Hope it helps :)
 
Share this answer
 
v4
Comments
[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