Visual Studio 2008 Intellisense for jQuery not working with jQuery 1.3.2 vsdoc

Have you faced issues with the Visual Studio 2008 Intellisense for jQuery. There are some issues of the intellisense not working with jQuery 1.3.2 vsdoc.

Some solutions:

- Install the hotfix for full jQuery Intellisense in VS 2008 http://blogs.msdn.com/webdevtools/archive/2008/11/07/hotfix-to-enable-vsdoc-js-intellisense-doc-files-is-now-available.aspx

- Download the latest jQuery vsdoc file from here http://code.google.com/p/jqueryjs/downloads/list

- The correct file to use is jquery-1.3.2-vsdoc2.js and not jquery-1.3.2-vsdoc.js

- Check this link http://blogs.ipona.com/james/archive/2009/01/14/jquery-1.3-and-visual-studio-2008-intellisense.aspx

Hiding a Column in an ASP.NET GridView

Two of the many ways you can hide a column in an ASP.NET GridView are as follows:

1. Set the GridView column’s 'Visibility' property to 'False'. However in this case, GridView will not bind the data to the GridView. So if you want to use that hidden column (like a Master-Detail scenario), you won't be able to do it.

You can also hide the column programmatically in the RowDataBound event


protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)


{


    e.Row.Cells[0].Visible = false;


}




VB.NET


Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)


    e.Row.Cells(0).Visible = False


End Sub




2. Use the OnRowCreated event which gets called after the data is bound

C#


protected void GridView1_OnRowCreated(object sender, GridViewRowEventArgs e)


{


  e.Row.Cells[0].Visible = false;


}




VB.NET


protected void GridView1_OnRowCreated(object sender, GridViewRowEventArgs e)


{


  e.Row.Cells[0].Visible = false;


}




Using this way, you can use a hidden column's data even if it is hidden.

Windows 7 RC will be freely available for download from May 5th '09

Microsoft released the RC (Release Candidate) of its much awaited Windows Operating System Windows 7. Windows 7 was made available from April 30th '09 for MSDN and TechNet Plus subscribers.

The good news is that from May 5th '09, the Windows 7 RC will be made available to general public too. So remember to visit the Windows 7 site and download this wonderful OS.

Note: Windows 7 RC will expire on March 1, 2010 after which the system will reboot every two hours. The license of windows 7 RC will expire on June 1, 2010.

For more info, check out the Microsoft Press Release over here

Also check out Windows 7 Release Candidate 1 impressions, insights, and expectations

Creating a Read Only List using LINQ

Have you felt the need of creating a read only List<> ? LINQ makes it very simple with the AsReadOnly() method. Here's how

C#


List<int> integ = new List<int>(){100,200,300,400,500};


IList<int> noModif = integ.AsReadOnly();


foreach (var i in noModif)


{


    // print i


}


 


try


{


    noModif.Add(600);


}


catch(Exception ex)


{


    // Exception raised stating that this collection is read only


}




VB.NET


 


Dim integ As New List(Of Integer)(New Integer() {100, 200, 300, 400, 500})


Dim noModif As IList(Of Integer) = integ.AsReadOnly()


For Each i In noModif


' print i


Next i


 


Try


    noModif.Add(600)


Catch ex As Exception


' Exception raised stating that this collection is read only


End Try


Quickly Replace Data in a String Array using LINQ

LINQ is amazingly flexible. Recently, I came across a client requirement where the client wanted to replace all '@' characters in emails with the text [attherate]. Here's how it can be done easily using LINQ. The same can also be done by looping through the array and replacing it, but LINQ gives you a lot of flexibility in filtering the data.

C#


        string[] emails = { "Shakiy@gmail.com", "Mary@hotmail.com", "Glenn@gmail.com", "Hillock@yahoo.com"};


 


        var modEmail = from em in emails


                           select new


                           {


                               EmailID = em,


                               ModifiedEmail = Regex.Replace(em, "[@]", "[attherate]")


                           };


 


        foreach (var mo in modEmail)


        {


            Response.Write(mo.ToString() + "<br/>");


        }




VB.NET


Private emails() As String = {"Shakiy@gmail.com", "Mary@hotmail.com", "Glenn@gmail.com", "Hillock@yahoo.com"}


 


var modEmail = from em in emails ReadOnly Property [New]() As select


                       em, ModifiedEmail = Regex.Replace(em, "[@]", "[attherate]")


                       EmailID = em, ModifiedEmail


End Property


 


For Each mo In modEmail


    Response.Write(mo.ToString() & "<br/>")


Next mo


Load pages in DIV using JQuery

If you have a <DIV> in your HTML or ASP.NET page and want to load another page in that DIV, then here's how to do so using one line of jQuery code


<html xmlns="http://www.w3.org/1999/xhtml">


<head runat="server">


    <title></title>


    <style type="text/css">


    .divPage


    {


        width:300px;


        height:200px;


    }


    </style>


 


    <script src="Scripts/jquery-1.3.2.js" type="text/javascript"></script>


    <script type="text/javascript">


        $(document).ready(function() {


        $('#LoadPage').load('Default.aspx');


        });    


    </script>


</head>


<body>


    <form id="form1" runat="server">


    <div>


    <div id="LoadPage" class="divPage">


    </div>


    </div>


    </form>


</body>


</html>


Can my class be serialized?

A common question asked is how do you determine if a class can be serialized? My answer is - serialize the class and then determine.

A common misconception is that if the class has the [Serializable] attribute, it can be serialized. This may or may not be the case. If any one of the fields in the class cannot be serialized, the serialization of the class fails.

If you would like to programmatically determine if a class can probably be serialized, use the following code. The code determines if the class Employee can be serialized or not:

C#


        Employee emp = new Employee();


        if (emp.GetType().IsSerializable)


        {


            Response.Write(emp.GetType().ToString() + " can probably be serialized");


        }


        else


        {


            Response.Write(emp.GetType().ToString() + " cannot be serialized");


        }




VB.NET


Dim emp As New Employee()


If emp.GetType().IsSerializable Then


    Response.Write(emp.GetType().ToString() & " can probably be serialized")


Else


    Response.Write(emp.GetType().ToString() & " cannot be serialized")


End If


Get your daily dose of Technology!

Have you been looking out for a Community based site where like-minded developers like you post links to the articles written by them or others? Here are 3 amazing sites which showcase stories submitted by users like you

www.dotnetkicks.com - DotNetKicks.com is a community based news site edited by our members. It specialises in .NET development techniques, technologies and tools including ASP.NET, C#, VB.NET, C++, Visual Studio, SubSonic, Open Source, SQL Server, Silverlight & Mono.

Individual users of the site submit and review stories, the most popular of which make it to the homepage. Users are encouraged to 'kick' stories that they would like to appear on the homepage. If a story receives enough kicks, it will be promoted.

www.dzone.com - Dzone is a free link-sharing community for developers. Anyone can submit new links to the incoming queue. Members vote on upcoming links to determine what gets promoted. Everyone can browse, search and comment on links

www.dotnetshoutout.com - DotNetShoutout is a place where you can find the latest Microsoft .NET stories to increase your skills and share your opinions.