What is ahead for .Net in 2010?

by Edward 29 November 2009 18:04

We are almost at the end of 2009, and this year there have been some interesting things happening in the world of .Net and Microsoft. There was the release of Silverlight 3, Internet Explorer 8, updates to the AJAX library and toolkit, and just over a month ago we got Windows 7.

I thought I would point out a few new .Net technologies to look out for next year.

  • Visual Studio 2010 and ASP.Net 4.0: Microsoft already released beta versions of Visual Studio 2010 that will be running the ASP.Net framework 4.0. They aim to release the newest edition of Visual Studio and ASP.Net 4.0 on 22 March 2010.
  • MVC Framework: The first version of this framework has been released in March 2009. Currently MVC 2.0 Beta is available for download. Microsoft has made several changes to this framework since the first release. You should find the latest version available for download in the first half of 2010.
  • JQuery: It has taken Microsoft a while to wake up, but it is nice to know that JQuery is being adopted by Visual Studio. JQuery is a Javascript library that has a lot of neat tools in it's bag.  It is very helpful for taking care of mundane tasks like "get that div" or "set that text box value."  It also has a great set of methods for dealing with AJAX.  
  • WCF, WF and WPF: ASP.Net is a maturing framework that will continue to move forward, with or without you. The best advice I have is to get on the wagon. Tools and accompanying frameworks are maturing in line, but behind, the .NET framework - your applications should be as well.  The earlier you start, the better. WCF, or known as Windows Communication Framework, is used to abstract the "plumbing" of your application. It can save you hours and hours of coding.
  • Silverlight 4.0: Microsoft Silverlight is a web application framework that provides functionalities similar to those in Adobe Flash, integrating multimedia, graphics, animations and interactivity into a single runtime environment. Silverlight 4.0 Beta has been released last month, so do not be surprised to see the latest version available before June 2010.

Tags: , , , , , , , ,

AJAX/JQuery | ASP.NET | Development Resources | Technology

JavaScript Exception Handling

by Edward 06 October 2009 06:16

Like any OOP (Object Oriented Programming), exception handling is also available in Javascript. The try/catch block in JavaScript is very much similar to the regular C# try/catch block, but you cannot handle the errors server side.

In the catch block you will get the object containing type and description of the exception, which you can then handle or write out to the screen, to see the error. You can also use the finally block in the same way as you use it in C#.

Here is a simple example:

window.onload = function()
{
    try
    {
        var x = 10;
        var calcvalue = x / y;
    }
    catch(err)
    {
        document.write("Error has been thrown:" + err.name + "<br /> Message: " + err.message + "<br />");
    }
    finally
    {
        alert('This is the finally block');
    }
}

Tags: ,

AJAX/JQuery

How to disable the mouse right-click menu

by Edward 23 September 2009 05:35

There are numerous javascript functions that allows you to disable the mouse right click functionality. However JQuery allows you to make it easier.

Here is an JQuery code example:

$(document).ready(function(){
    $(document).bind("contextmenu",function(e){
        return false;
    });
});

Tags: ,

AJAX/JQuery

Adding JQuery to ASP.NET web pages

by Edward 08 March 2009 18:59

Adding JQuery Reference to ASP.NET pages

Quick How to...

Firstly create your website project, or select a page on your current website where you want to add JQuery functionality.

Get the latest jQuery javascript file from here.

Add the file to the root of your website, or a specified folder. Add a reference the the js file from the page you want to use it. You can also add the Script Reference to the JQuery file in ASP.NET’s AJAX Script Manager Control.

Instead of writing the script element directly, the script can be added to the set of scripts that the ScriptManager controls using a ScriptReference element. By including it this way, we are assured that it will be loaded at a point when the ASP.NET AJAX Library is available.

    <asp:ScriptManager runat="server" ID="ScriptManager1">
        <Scripts>
            <asp:ScriptReference Path="jQuery.js" />
        </Scripts>
    </asp:ScriptManager>


You can now add jQuery functionality to your page. Make sure you add your logic to JQuery’s "ready event" as below:

    $(document).ready(function(){
       // Your code here
    });


It makes sure that all the object(s) you reference are available and safe to manipulate the DOM.

If you want to manipulate all the links element <a>, take a look at the following snippet.

    $("a").click(function(event){
       alert("Hello World!");
    });


Above code snippet will get all the <a> elements to be worked on and execute when you click the link(s) available on ASP.NET page which shows an alert box.

Next, we need to create a CSS Class. Add the CSS class in your page like this.

    <style type="text/css">
            a.
mylink
            {
                font-weight: bold;
            }
    </style>


then add the CSS class as below:

    $("a").addClass("mylink");


all your <a..> elements would now be bold. To remove the CSS class you’d use

    $("a").removeClass("mylink");

Special Effects [Animation]

In JQuery, some basic effects are provided, to test how it works take a look at following snippet.

    $("a").click(function(event){
       event.preventDefault();
       $(this).hide("slow");
    });


Now, if you click any link, it should make itself slowly disappear.

For more help on JQuery, please visit the tutorials page on the JQuery Documentation website.

Tags: , , ,

AJAX/JQuery | ASP.NET

About DasCode.Net

I'm a ASP.NET web developer and code enthusiast. Blogging about everything .Net related.

Code... that's .net

Month List