For years now, I’ve worked in ASP.NET, which provides a lot of assistance – thus it’s reason to exist. Sometimes, unknowingly to me, I lose site of what all .NET is doing for me. Take for example, displaying a date. For the ASP.NET guy, one would go to the master page, setup a HTML element that is shown on every page, and call some server-side code leveraging System.DateTime.Now.ToString(format) and done!
You’ll need a place on the screen obviously to show the date. In my simple case, I did the following:
Next, something on the page has to call the function. While there are several ways to do this, I decided to leverage the browser’s ONLOAD event, like the following. So, when the page displays, the date will be shown.
That’s it. I know this is a simple example, but wanted to see if I could get it figured out.
I’d much rather do this with ASP.NET!