Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts

Friday, 16 September 2011

The next release of .NET

A while ago some concerns were expressed regarding Microsoft’s plans for .NET, based on an article that was written in response to a Windows 8 preview in May (see earlier post). During the preview session, not much was mentioned about these plans.

In last week’s Windows 8 Build event, MS provided details on the forthcoming release of .NET 4.5. The following session outlines the new features in .NET 4.5 supporting Windows 8.

http://channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-834T

Essentially this is a mainly incremental release (although including some substantial changes to the CLR to support new Windows 8 technologies). There is no evidence or suggestion that there are any plans to replace .NET with any framework based on HTML 5 and/or Javascript as suggested elsewhere.

Monday, 27 June 2011

The end of .NET is in sight?

Since the first week of June there have been a number of internet posts claiming that Microsoft are planning to dump the .NET platform in a bid to be seen as pursuing a platform independent strategy. For example:

http://www.i-programmer.info/professional-programmer/i-programmer/2591-dumping-net-microsofts-madness.html

This article provides a more balanced look at the story:

http://arstechnica.com/microsoft/news/2011/06/windows-8-for-software-developers-the-longhorn-dream-reborn.ars

The Microsoft Windows division have recently announced that they are providing HTML5 and Javascript APIs in Windows 8, and haven’t mentioned any planned new .NET features. As a result, some .NET developers have been demanding to know what Microsoft plans are for .NET. The Microsoft response has been, wait and see – we’ll explain all at the Build event in September. As a result theres a lot of hysteria about .NET being flushed down the toilet.

This announcement has basically been about the UI on Windows clients. The VS team has been working on better HTML5/Javascript support since VS 2010 came out last year. So Microsoft have decided the future of the UI involves HTML5/Javascript. So does virtually every other vendor. I wouldn’t be surprised if they do deprecate WPF and/or Silverlight and replace these with a new Windows client presentation technology, as there has been a disappointing takeup of these technologies.

I think that it is highly unlikely that Microsoft are going to expect developers to write middle tier components in Javascript, or any other dynamically typed language that lacks the safety of a static type system. I have not seen any mention of any plans to replace the CLR with new middleware. So I think it likely that the .NET platform will continue to be used for application services. There is a lot of .NET middleware functionality like WCF that is also going to have to be replaced if they retire the whole platform.

As far as the UI on web applications goes, again they have been providing better support for HTML5/Javascript, and have integrated support for the open source jQuery framework. The VS team are working on improving client side HTML5/Javascript debugging tools. They are still going to provide a web application framework to support HTML5/Javascript application development. If they keep the .NET platform, then I think it likely they will continue to develop ASP.NET to support HTML5 features.

This story is more about mismanaged communications with the developer community than anything else.

It should also be noted that much of the hype behind this story is coming from open source protagonists. It should also be pointed out that periodically Java gets a kicking in response to a bungled Oracle management initiative. For example:

http://www.devx.com/Java/Article/45527

http://www.readwriteweb.com/enterprise/2011/01/why-the-future-of-java-is-with.php

Before coming to any firm conclusions about the death of .NET I suggest we wait and see what Microsoft announces in September.

Tuesday, 15 February 2011

How to display a jQuery datepicker control in an ASP.NET MVC partial view

When trying to use the jQuery datepicker in an ASP.NET MVC partial view I found that the calendar didn't display correctly.  On investigating the problen I realized I was calling the datepicker function in the wrong place.  Calling it in the partial view doesn't work - the MVC framework ignores the script when it renders the partial view in the .aspx view.  Calling it in the .aspx view's document ready event doesn't work either because at this stage it doesn't know about the control.

Here's a way to get it working.

Firstly, link the jQuery UI CSS file in the head section of the master file:

<link type="text/css" href="../../Content/jquery-ui-1.8.9.custom.css" rel="stylesheet" />

Add the jQuery script references to the head section of the master file (or in the appropriate asp:Content section in the .aspx view in which you're posting the partial view):

<script type="text/javascript" src="../../Scripts/jquery-1.4.1.js"></script>
<script type="text/javascript" src="../../Scripts/jquery-ui-1.8.9.custom.min.js"></script>

Create a Javascript function that calls the datepicker function:

<script type="text/javascript">
    function showDatePicker() {
        $('#date').datepicker();
    }
</script>

Declare the input element in the partial view, making sure to give it the same id you used in the call to datepicker:

<input type="text" name="date" id="date" />

Finally (this is the crucial bit), you need to call this function in the OnSuccess parameter of the Ajax call in the .aspx view, e.g.:

<li><%= Ajax.ActionLink("Some text to click on", "action_name", new { Id = Model.Id }, new AjaxOptions { OnSuccess = "showDatePicker", UpdateTargetId = "div_name" })%></li>

Note that this doesn't work if you use the OnComplete parameter.