Display a Progress bar while loading content in a DIV using jQuery

Sometime back, I had written an article on Loading pages in DIV using JQuery. A user mailed back asking if it was possible to display a progress bar while the DIV loads its content. Well yes it is possible as shown here:

<html xmlns="http://www.w3.org/1999/xhtml">
<
head runat="server">
<
title>Display Progress</title>
<
script src="Scripts/jquery-1.3.2.js"
type="text/javascript"></script>
<
style type="text/css">
.divPage
{
width:300px;
height:200px;
}
</style>

<
script type="text/javascript">
$(document).ready(function() {
$("#imgProg").show();
$('#LoadPage').load('Default.aspx', function() {
$("#imgProg").hide();
});
});
</script>
</
head>
<
body>
<
form id="form1" runat="server">
<
div>
<
div id="LoadPage" class="divPage"></div>
<
img alt="Progress" src="progress.gif" id="imgProg"
visible="false" />
</
div>
</
form>
</
body>
</
html>



As shown above, we make use of the a gif image to display progress while the Default.aspx page loads. Observe that progress.gif is set to visible=false.

How to Prevent Word Wrap in an ASP.NET GridView

 

Recently I came across an interesting answer by Jason, where he suggests how to stop word wrap in an ASP.NET GridView. I thought of sharing this trick with the viewers facing similar issues:

The trick is to use

<td style="WORD-BREAK:BREAK-ALL;">


Check this sample:



<style type="text/css">
.DisplayDesc { width:500px;word-break : break-all }
.DisplayDiv { width:500px; OVERFLOW:hidden;
TEXT-OVERFLOW:ellipsis}
</style>

<
asp:TemplateField>
<
ItemStyle Font-Names="Tahoma" Font-Size="X-Small"
HorizontalAlign="Left"
Wrap="True" />
<
ItemTemplate>
<
div class="DisplayDiv">
<
asp:Label CssClass="DisplayDesc" ID="Label1"
runat="server"
Text='<%# Bind("SomeLongText") %>'></asp:Label>
</
div>
</
ItemTemplate>
</
asp:TemplateField>


I am sure there are many developers who had this problem in the past without a decent solution. Let me know if it worked for you!

LINQ To XML Tutorials That Make Sense

Sometime back, I had posted some LINQ to XML Tutorials on dotnetcurry.com demonstrating some common operations with 'How Do I’ kind of LINQTOXML examples. Check them out over here:

Some Common Operations using LINQ To XML - Part I

Some Common Operations using LINQ To XML - Part II

Some Common Operations using LINQ To XML - Part III

You can also check my other articles on LINQ over here LINQ Articles

Hope you like them all!

Collapse all Open Nodes Of an ASP.NET TreeView when Another Node is expanded

Users have a very common requirement around the ASP.NET TreeView - that is to keep only one TreeNode expanded at a given point of time. So if a TreeNode in the TreeView is expanded, collapse the other open TreeNodes. Here's how to do so:


 <asp:TreeView ID="TreeView1" runat="server"


        ontreenodeexpanded="TreeView1_TreeNodeExpanded">


        <Nodes>


            <asp:TreeNode Text="Node1" Value="Node1">


                <asp:TreeNode Text="Node1.1" Value="Node1.1"/>


                <asp:TreeNode Text="Node1.2" Value="Node1.2"/>


                <asp:TreeNode Text="Node1.3" Value="Node1.3"/>


            </asp:TreeNode>


            <asp:TreeNode Text="Node2" Value="Node2">


                <asp:TreeNode Text="Node1.1" Value="Node2.1"/>


                <asp:TreeNode Text="Node1.2" Value="Node2.2"/>


            </asp:TreeNode>


            <asp:TreeNode Text="Node3" Value="Node3">


                <asp:TreeNode Text="Node3.1" Value="Node3.1"/>


                <asp:TreeNode Text="Node3.2" Value="Node3.2"/>


            </asp:TreeNode>


        </Nodes>


</asp:TreeView>




C#


protected void TreeView1_TreeNodeExpanded(object sender, TreeNodeEventArgs e)


{


    // Loop through all nodes


    foreach (TreeNode treenode in TreeView1.Nodes)


    {


        // If node is expanded


        if (treenode != e.Node)


        {


            // Collapse all other nodes


            treenode.Collapse();    


        }


    }


}




VB.NET


    Protected Sub TreeView1_TreeNodeExpanded(ByVal sender As Object, ByVal e As TreeNodeEventArgs)


        ' Loop through all nodes


        For Each treenode As TreeNode In TreeView1.Nodes


            ' If node is expanded


            If treenode IsNot e.Node Then


                ' Collapse all other nodes


                treenode.Collapse()


            End If


        Next treenode


    End Sub


Windows 7 Beta will Auto Shut Down every 2 hours from July 1st 2009

It's official now. The Bi-hourly shutdowns for the Windows 7 Beta will begin July 1st, 2009 and will expire on August 1st 2009. This post comes as a saver, since a few days ago, all Windows 7 Beta users got an email miscommunicating that the bi-hourly shutdowns will begin June 1st 2009, instead of July 1st, 2009.

So if any one of you are still using Windows 7 Beta, you have around 34 days from now to download and install the Windows 7 RC, saving you from going through the pains of seeing your PC shutting down every 2 hours. Ahemm..sound familiar eh!

Changing the Background Color of an ASP.NET AJAX CalendarExtender

By default, an ASP.NET AJAX CalendarExtender looks similar to the following:



However if you want to change the header/background color of an ASP.NET AJAX CalendarExtender, then here's how to do it using CSS.


<head runat="server">


    <title></title>


    <style type="text/css">


        .cal .ajax__calendar_header


        {


              background-color: Silver;


        }


        .cal .ajax__calendar_container


        {


                background-color: Gray;


        }        


    </style>


</head>


<body>


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


    <div>


        <asp:ScriptManager ID="ScriptManager1" runat="server">


        </asp:ScriptManager>


        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>


        <cc1:CalendarExtender ID="CalendarExtender1" runat="server" CssClass="cal"


        TargetControlID="TextBox1" >


        </cc1:CalendarExtender>


    </div>


    </form>


</body>


</html>




After applying the CSS, the CalendarExtender will look similar to the following:

Bind an ASP.NET DropDownList to a Dictionary

I have seen a lot of folks keeping data in a Dictionary<,>. However when it comes to binding this Dictionary with a control, they feel lost!

Here's a simple way that demonstrates how to bind a Dictionary to an ASP.NET DropDownList control


        <asp:DropDownList ID="ddlRelatives" runat="server">


        </asp:DropDownList>




C#


    Dictionary<int, string> dicRel = new Dictionary<int, string>();


    dicRel.Add(1, "Father");


    dicRel.Add(2, "Mother");


    dicRel.Add(3, "Brother");


    dicRel.Add(4, "Sister");


    dicRel.Add(5, "Others");


    ddlRelatives.DataSource = dicRel;


    ddlRelatives.DataTextField = "Value";


    ddlRelatives.DataValueField = "Key";


    ddlRelatives.DataBind();




VB.NET


    Dim dicRel As New Dictionary(Of Integer, String)()


    dicRel.Add(1, "Father")


    dicRel.Add(2, "Mother")


    dicRel.Add(3, "Brother")


    dicRel.Add(4, "Sister")


    dicRel.Add(5, "Others")


    ddlRelatives.DataSource = dicRel


    ddlRelatives.DataTextField = "Value"


    ddlRelatives.DataValueField = "Key"


    ddlRelatives.DataBind()


Tech.Ed India 2009 - What a blast I had!

Another episode of TechEd was successfully executed at Hyderabad, India. I know this post comes a little late since the event got over on the 16th and I am 9 days late in posting this. However I HAD to share, my experience with you guys, especially the one where I met Stephen Walther and exchanged ideas and feedback with him!



Here are a few highlights of the event:

Keynote by Steve Ballmer - The star attraction of Tech.Ed India 2009, the keynote by Steve Ballmer, was a rock on, where he spoke about the current market situations and how to beat the recession heat!



Rock solid Technical Sessions - including the one from Stephen Walther. For those who do not know much about Stephen Walther, he is the author of the very famous ASP.NET book ASP.NET 3.5 Unleashed. This is one book you MUST have in your collection if you are an ASP.NET developer and want to get a deep understanding of the technology. This is one of the best books i have had.

Stephen also has an upcoming book (much awaited) on ASP.NET MVC ASP.NET MVC Framework Unleashed which I highly recommend you must have in your collection.



UPDATE: Stephen's Tech.Ed Sessions and code can be downloaded over here http://stephenwalther.com/blog/archive/2009/05/27/back-from-tech-ed-india.aspx

Keynote by Resul Pookutty - Academy Award Winner-Film Sound Designer (Slumdog Millionaire)



Social Networking - I also got a chance to chit-chat with some great bloggers like Geetesh Bajaj, Pinal Dave and Niraj Bhatt



Food and Entertainment - Food was amazing all the three days coupled with entertainment including live performances by a rock band called Agnee.



To see other photos on the event, check out these captured by Abhishek Baxi.

Overall it was an amazing event with good food, sessions and social networking. I had a lot of experiences to take back home. Oh Boy! What a blast I had!

What's next? Tech.Ed 2010?

Replicating the 'IN' operator in LINQ

We often use the 'IN' Operator to specify multiple values in the WHERE clause. What if you have to do something similar in LINQ. Here's a simple example that demonstrates this. The example searches out the desired pincodes in a list of Booth Addresses.

C#


var pinCodes = new[] { 411021, 411029, 411044 };


var Booths = new[] {


    new { BoothName = "Booth1", PinCode = 411011 },


    new { BoothName = "Booth2", PinCode = 411021},


    new { BoothName = "Booth3", PinCode = 411029 },


    new { BoothName = "Booth4", PinCode = 411044 },


    new { BoothName = "Booth5", PinCode = 411056 },


    new { BoothName = "Booth6", PinCode = 411023 },


    new { BoothName = "Booth7", PinCode = 411024 }


};


 


var whereAmI = from booth in Booths


              join pins in pinCodes


              on booth.PinCode equals pins


              select booth;




VB.NET


        Dim pinCodes = New Integer() {411021, 411029, 411044}


        Dim Booths = New Object() _


        {New With {Key .BoothName = "Booth1", Key .PinCode = 411011}, _


        New With {Key .BoothName = "Booth2", Key .PinCode = 411021}, _


        New With {Key .BoothName = "Booth3", Key .PinCode = 411029}, _


        New With {Key .BoothName = "Booth4", Key .PinCode = 411044}, _


        New With {Key .BoothName = "Booth5", Key .PinCode = 411056}, _


        New With {Key .BoothName = "Booth6", Key .PinCode = 411023}, _


        New With {Key .BoothName = "Booth7", Key .PinCode = 411024}}


 


        Dim whereAmI = _


         From booth In Booths _


         Join pins In pinCodes On booth.PinCode Equals pins _


         Select booth




OUTPUT

Copy Text From One ASP.NET TextBox To Another

Here's a simple way of copying Text From One ASP.NET Text Box to Another as the user types, using JavaScript

Add the following TextBox to your page


<asp:TextBox ID="txtOne" runat="server" onkeyup="OneTextToOther();"></asp:TextBox>


<asp:TextBox ID="txtTwo" runat="server"></asp:TextBox>




Now add the following JavaScript in the <head> section of your page


<head>


    <title></title>


    <script type="text/javascript">


        function OneTextToOther() {


            var first = document.getElementById('<%= txtOne.ClientID %>').value;


            document.getElementById('<%= txtTwo.ClientID %>').value = first;


        } 


    </script>


</head>


Find the First and Last Day of the Current Quarter

A very handy piece of code by Karl that finds the first and last day of the current quarter.

C#


DateTime datetime = DateTime.Now;


int currQuarter = (datetime.Month - 1) / 3 + 1;


DateTime dtFirstDay = new DateTime(datetime.Year, 3 * currQuarter - 2, 1);


DateTime dtLastDay = new DateTime(datetime.Year, 3 * currQuarter + 1, 1).AddDays(-1);


 


Response.Write("First Day of Quarter - " + dtFirstDay.ToShortDateString() + " : " +


    "Last Day of Quarter - " + dtLastDay.ToShortDateString());




VB.NET


Dim datetime As DateTime = DateTime.Now


Dim currQuarter As Integer = (datetime.Month - 1) / 3 + 1


Dim dtFirstDay As New DateTime(datetime.Year, 3 * currQuarter - 2, 1)


Dim dtLastDay As New DateTime(datetime.Year, 3 * currQuarter + 1, 1).AddDays(-1)


 


Response.Write("First Day of Quarter - " & dtFirstDay.ToShortDateString() & " : " _


& "Last Day of Quarter - " & dtLastDay.ToShortDateString())


Visual Studio 2010 Beta 1 and .NET 4.0 Beta 1 Now Available for General Public to Download

Visual Studio 2010 Professional and Team System Beta 1 as well as .NET 4.0 Beta 1 are now available to MSDN subscribers as well as general public to download.

MSDN subscribers can download the bits over here.

Non-MSDN subscibers can download the bits over here.

Download Visual Studio 2010 Professional Beta now
Download Visual Studio Team System 2010 Beta now
Other download options

Get an insider view of the features in Visual Studio 2010 by downloading the PDF over here

Adding Crome to Visual Studio 2008 List of Browsers

If you are looking out for the steps to add Crome as a browser while debugging in Visual Studio, then here are these simple steps:

Step 1: Right Click any aspx page in Visual Studio > Browse With. This brings up a 'Browse With' Dialog.

Step 2: Click on 'Add..'. I am on Vista and my Crome.exe is in C:\Users\Suprotim\AppData\Local\Google\Chrome\Application\chrome.exe

Type this path in the program name and give it a friendly name as shown below



Click Ok. Once the browser has been added, you can now view your asp.net pages in Visual Studio using Crome.

Get UserID of the user using ASP.NET Membership

Retreiving the UserId for a user while using the ASP.NET Login controls is very simple, yet it still is one of the most frequently asked questions on the forums. Here's how to do so:

C#


    protected void Page_Load(object sender, EventArgs e)


    {


        System.Web.Security.MembershipUser mu = System.Web.Security.Membership.GetUser();


        string strUsrId = mu.ProviderUserKey.ToString();       


    }




VB.NET


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)


        Dim mu As System.Web.Security.MembershipUser = System.Web.Security.Membership.GetUser()


        Dim strUsrId As String = mu.ProviderUserKey.ToString()


    End Sub


Windows Azure Management Tool

The Windows Azure Management Tool is an invaluable resource to manage storage accounts in Windows Azure by providing features to debug, create, and explore your storage solutions as well as inspect messages in the queues.

As given on the Microsoft site, some features of this tool are:

-Manage multiple storage accounts
-Easily switch between remote and local storage services
-Manage your blobs
-Manage your queues

You can learn more about the Windows Azure Management Tool here.

Find the Actual URL using TinyUrl

TinyURL is a cool service to make long url's short.

However what if you have a TinyURL and now want to preview the actual url. The preview will save you from clicking on a TinyURL that you are not very sure of.

Here's how to do so:

1. Navigate to the Preview Feature of TinyURL.

2. Click on 'Click here to enable previews'. This step adds a cookie to your browser.

3. Now take any TinyURL such as http://tinyurl.com/gridviewtips. To view the actual url, replace the url with the following:

http://preview.tinyurl.com/gridviewtips

You will get the following screen:



You can now preview and proceed to the actual link. Infact as long as the Preview feature is enabled, you do not have to manually use the preview url. Any TinyURL will automatically take you to the Preview URL page.

Using jQuery to Prevent ASP.NET Server Side Events from Occuring

I recently was wiring up the ASP.NET Button control with jQuery and checking out the different events related to the same. I also wanted to see if it was possible to stop a server side event from occuring using jQuery.

For example: I have an ASP.NET button control which causes a postback when it is clicked. However what if you want to check a condition at ClientSide and then allow the postback to occur. Here's how to prevent a postback from occuring using jQuery.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


 


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


<head runat="server">


    <title></title>


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


    <script type="text/javascript">


        $(document).ready(function() {


            $("#<%=Button1.ClientID %>").click(function() {


                // check a condition


                if ("a" == "b")


                    return true;


                else


                    return false;


            });


        });


    </script>


</head>


<body>


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


    <div>


        <asp:Button ID="Button1" runat="server" Text="Click Me"


            onclick="Button1_Click" />


    </div>


    </form>


</body>


</html>


Missed Tech.Ed India? Here's how to catch up with the latest happenings @Tech.Ed

Did you miss out on the biggest technology event Tech.Ed India 2009? Missed out on Steve Ballmer's LIVE keynote? Well you can still catch up with things live as it happens from TechEd India 2009. You can watch all the action from the twitterverse. Here's how:

Official TechEd India 2009 Twitter:
http://twitter.com/techedindia2009

The twitter chatter from community:
http://twitter.com/#search?q=techedin
[Hint: If you want your tweet featured, include the hastag #techedin inyour tweet]

Pictures from TechEd India 2009:
http://www.flickr.com/photos/tags/techedin/

Join Steve Ballmer Live on Stage:
http://virtualtechdays.com/joinsession.aspx

Some community mashups created by attendees:

MVP Blogs from TechEd India:
http://teched.indiamvp.net

TechEd MashUp:
http://baxiabhishek.info/teched/

How to convert ASP.NET Bulleted List items or UnOrdered List to Hyperlinks using jQuery

I came across an interesting problem recently. I had a bulleted list with me which listed the url's of websites. However the url's were just plain text as shown below:


    <div>


        <asp:BulletedList ID="BulletedList1" runat="server">


            <asp:ListItem Text="http://www.dotnetcurry.com" Value="Site 1" />


            <asp:ListItem Text="http://www.sqlserver.com" Value="Site 2" />


            <asp:ListItem Text="http://www.devcurry.com" Value="Site 3" />


        </asp:BulletedList>


    </div>




My client wanted me to convert them to hyperlinks dynamically since it was not possible to go ahead and make changes in the Bulleted List mark up. Here's how to convert an unordered list <ul> to hyperlinks using jQuery


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


 


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


<head runat="server">


    <title></title>


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


    <script type="text/javascript">


        $(document).ready(function() {


        $('ul > li').css({


        "cursor": "pointer",


        "text-decoration": "underline",


        "color":"blue"


         })


            .click(function() {


                window.location = $(this).text()


            });


        });


    </script>


</head>


<body>


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


    <div>


        <asp:BulletedList ID="BulletedList1" runat="server">


            <asp:ListItem Text="http://www.dotnetcurry.com" Value="Site 1" />


            <asp:ListItem Text="http://www.sqlserver.com" Value="Site 2" />


            <asp:ListItem Text="http://www.devcurry.com" Value="Site 3" />


        </asp:BulletedList>


    </div>


    </form>


</body>


</html>




As you can observe, we are adding some css attributes to the <li> to make it look like a link - css has been applied to underline it, add a pointer on mouseover and change its color to blue.

We then add a click function which sets the url, to the text of the list items of the Bulleted List. That's it.

Oh..I love jQuery!

I am attending Tech.Ed India tomorrow at Hyderabad

I am glad I will be attending Tech-Ed India tomorrow at Hyderabad.

Tech.Ed-India 2009 is being held in Hyderabad from May 13-15. The agenda includes some deep drive technology sessions, product group interactions, free certifications, Hands on Labs and a lot more. Get a detailed view of the agenda over here.

All Tech.Ed-India 2009 attendees can get certified for free. Learn more over here
http://www.microsoft.com/india/teched2009/freesertification.aspx

How do you recognize me?

Check My Profile Here

If you are able to locate me, make sure you drop by and say a Hi!

Fastest way to programmatically create HTML Elements using jQuery

I stumbled across an interesting answer by Owen and a few others on stackoverflow discussing the fastest way to create HTML Elements using jQuery. Here are some excerpts:

4 possible ways of creating HTML elements (like a DIV) using jQuery are :

var newEle = $(document.createElement('div'));
var newEle = $('<div>');
var newEle = $('<div></div>');
var newEle = $('<div/>');

After performing a test to create HTML Elements using jQuery as Owen suggested, here were the results. I have clubbed all the 4 tests here for better readibility. However you should run each test for every new way of creating elements, individually.

Test


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



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


<head runat="server">


<title></title>


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



<script type="text/javascript">


$(document).ready(function() {


var counter = 5000;


var startTime = new Date().getTime();


// First Test


for (i = 0; i < counter; ++i) {


var newEle = $(document.createElement('div'));


}


var endTime = new Date().getTime();


alert(endTime - startTime);



// Second Test


var counter = 20000;


var startTime = new Date().getTime();



for (i = 0; i < counter; ++i) {


var newEle = $('<div>');


}


var endTime = new Date().getTime();


alert(endTime - startTime);




// Third Test


var counter = 20000;


var startTime = new Date().getTime();



for (i = 0; i < counter; ++i) {


var newEle = $('<div></div>');


}


var endTime = new Date().getTime();


alert(endTime - startTime);



// Fourth Test


var counter = 20000;


var startTime = new Date().getTime();



for (i = 0; i < counter; ++i) {


var newEle = $('<div/>');


}


var endTime = new Date().getTime();


alert(endTime - startTime);


});



</script>


</head>


<body>


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


<div>



</div>


</form>


</body>


</html>




Results:

The fastest way to create an HTML element using jQuery is using :
var newEle = $(document.createElement('div'));

The slowest one was :
var newEle = $('<div></div>');

List of LINQ Providers

I recently bumped into Charlie Calvert's Community Blog where he has listed down the different LINQ Providers created by geeks. Here is the list

LINQ to Amazon
LINQ to Active Directory
LINQ to Bindable Sources (SyncLINQ)
LINQ over C# project
LINQ to CRM
LINQ To Geo - Language Integrated Query for Geospatial Data
LINQ to Excel
LINQ to Expressions (MetaLinq)
LINQ Extender (Toolkit for building LINQ Providers)
LINQ to Flickr
LINQ to Google
LINQ to Indexes (LINQ and i40)
LINQ to IQueryable (Matt Warren on Providers)
LINQ to JSON
LINQ to NHibernate
LINQ to JavaScript
LINQ to LDAP
LINQ to LLBLGen Pro
LINQ to Lucene
LINQ to Metaweb(freebase)
LINQ to MySQL, Oracle and PostgreSql (DbLinq)
LINQ to NCover
LINQ to Opf3
LINQ to Parallel (PLINQ)
LINQ to RDF Files
LINQ to Sharepoint
LINQ to SimpleDB
LINQ to Streams
LINQ to WebQueries
LINQ to WMI
LINQ to XtraGrid

You can check the links to these providers over here

A List of LINQ Providers

Display and Fade an ASP.NET Panel or HTML DIV using jQuery

I recently saw a UI Effect on a website where on clicking a button, a panel appeared and then faded out after a few seconds. Cool and a good candidate for jQuery. Here's how to do it on an HTML DIV element or an ASP.NET Panel using jQuery


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


<head runat="server">


    <title></title>


 


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


    <script type="text/javascript">


        $(document).ready(function() {


            $("#Panel1").hide();


            $("#Button1").click(function() {


                $("#Panel1").show().animate({ margin: 0 }, 4000).fadeOut();


            });


        });


 


    </script>


</head>


<body>


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


    <div>


        <asp:Panel ID="Panel1" runat="server" BackColor="Gray">


        Lorem Ipsum Lorem Ipsum Lorem Ipsum<br />


        Lorem Ipsum Lorem Ipsum Lorem Ipsum<br />


        Lorem Ipsum Lorem Ipsum Lorem Ipsum<br />


        Lorem Ipsum Lorem Ipsum Lorem Ipsum<br />       


        Lorem Ipsum Lorem Ipsum Lorem Ipsum


        </asp:Panel>


        <input id="Button1" type="button" value="Display and Fade" />


    </div>


    </form>


</body>


</html>




Download jQuery over here

Fetching all controls on a page ordered by their ID

Here's a simple to way to fetch all the controls on an ASP.NET page ordered by their ID's

C#



    protected void Button1_Click(object sender, EventArgs e)


    {


        var ctrl = from ctr in this.Controls.Cast<Control>().OrderBy(c => c.ID)


                   select ctr;     


    }




VB.NET


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)


    Dim ctrl = _


     From ctr In Me.Controls.Cast(Of Control)().OrderBy(Function(c) c.ID) _


     Select ctr


End Sub


How to Open a ASP.NET AJAX ModalPopUpExtender at PageLoad

A simple way of opening an ASP.NET AJAX ModalPopUpExtender on PageLoad is shown below. Add the following script to the <head> section of your page


<head runat="server">


    <title></title>


    <script type="text/javascript">


        function pageLoad() {


            var pop = $("modalPopUpExtender1");


            pop.show();


        }


    </script>


</head>


Windows 7 RC Now Available for General Public To Download

Windows 7 can now be downloaded by general public for free. Microsoft made the download available today. The 32- and 64-bit versions of Windows 7 RC are available in 5 languages: English, German, Japanese, French, and Spanish. Here are some important links related to Windows 7:

Download Windows 7 (Available to All)

Windows 7 Installation Instructions

Windows 7 Frequently Asked Questions

Note: The RC will expire on June 1, 2010. Starting on March 1, 2010, your PC will begin shutting down every two hours.

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.