I am trying to pass values which I am taking from an external js File into my .aspx page.
Here Is my .js file code:
function GETdateTime() {
var d = new Date()
var date = new String(d.getDate() + "/" + (d.getMonth() + 1) + "/" + d.getFullYear());
var time = new String(d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds());
document.getElementById("test").outerHTML = "<br>" + date + "<br>" + time;
}
In my .aspx page I am calling the above function and retrieving results like:
<form id="form1" runat="server" method =" post">
<span id = "test"> </span>
<script type =" text/javascript" src="JavaScript1.js" >
</script>
<script type ="text/javascript">
GETdateTime();
</script>
</form>
What I am trying to achieve is that I am planning to have one HiddenField
which would store the date, time and other things
and then grab the values in that HiddenField
and pass them to my vb.net code behind to store them in a string. The problem is that I have seen to many approaches and I am kind of confused with which one to go with like here,here and here. I am also considering efficiency, consistency, flexibility and overall performance. Any thoughts or suggestions would be appreciated.