Windows Phone Developer Tools CTP Update!

You can now build Windows Phone 7 apps on the final release of Visual Studio 2010 (VS2010).

You can download the Windows Phone Developer Tools CTP Refresh (WPDT CTP) from http://developer.windowsphone.com

Please read the release notes before installing this refresh.

Read more on this release over here Windows Phone Developer Tools CTP Refresh!

Sort a String Array containing Numbers using LINQ

Here’s how to use LINQ to sort a String Array containing Numbers

C#

static void Main(string[] args)
{
string[] arr = { "3", "1", "6", "10", "5", "13" };
foreach (var num in arr.OrderBy(x => int.Parse(x)))
{
Console.WriteLine(num);
}
Console.ReadLine();
}

VB.NET

Sub Main(ByVal args() As String)
Dim arr() As String = { "3", "1", "6", "10", "5", "13" }
For Each num In arr.OrderBy(Function(x) Integer.Parse(x))
Console.WriteLine(num)
Next num
Console.ReadLine()
End Sub

OUTPUT

image

Using jQuery to Trigger a Link only if a Condition is met

I was recently asked a question. How to prevent a link from triggering if a condition is not met. Here’s a very simple code to do so. If the values of two textboxes do not match, the link does not get clicked. If the values match, the user is navigated to the URL the link points to.

<html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
title>Prevent a Link from Navigating</title>
<
script type="text/javascript"
src="http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.min.js">
</
script>
<
script type="text/javascript">
$(function() {
$('#anc').click(function(e) {
if($("#Text1").val() != $("#Text2").val())
e.preventDefault();
});
});
</script>
</
head>
<
body>
<
form id="form1" action="">
<
input id="Text1" type="text" /><br />
<
input id="Text2" type="text" /><br />
<
a id="anc" href="http://www.dotnetcurry.com">Click me</a>
</
form>
</
body>
</
html>

Note: You should add an extra check to see if the boxes are not empty.

Live Demo

Validate IP Address using jQuery

I had recently posted on Add a Custom Validation Method to the jQuery Validation Plugin. A user asked me over twitter asking how to validate IP address using this method.

Here’s the same custom validation method that now validates an IP address. I am using regex to do so (The regular expression was searched on the net)

<html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
title>Validate IP Address using jQuery</title>
<
script type="text/javascript"
src="http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.min.js">
</
script>
<
script type="text/javascript" src=
"http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js">
</
script>
<
script type="text/javascript">
$(function() {
$.validator.addMethod('IP4Checker', function(value) {
var ip = "^(?:(?:25[0-5]2[0-4][0-9][01]?[0-9][0-9]?)\.){3}" +
"(?:25[0-5]2[0-4][0-9][01]?[0-9][0-9]?)$";
return value.match(ip);
}, 'Invalid IP address');

$('#form1').validate({
rules: {
ip: {
required: true,
IP4Checker: true
}
}
});

});
</script>
</
head>
<
body>
<
form id="form1">
<
input id="ip" name="ip" type="text" />
<
input id="Submit1" type="submit" value="submit" />
</
form>
</
body>
</
html>

On running the code, enter an IP address. The validation detects an invalid IP and displays the message “Invalid IP address”

Validate IP jQuery

Once you enter a valid IP, you can submit the form

Validate IP jQuery

Live Demo

Add a Custom Validation Method to the jQuery Validation Plugin

When it comes to Validation using jQuery, the jQuery Validation Plugin is my obvious choice. This plugin provides you with a number of pre-built validation logic. However if you need to build a custom validation method of your own, then here’s how to do so.

In the code shown below, we will add a custom validation method that checks to see if the Age entered is greater than 18. Please see that this is just a demonstration, so feel free to replace the code with a validation logic of your own

<html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
title>Quickly validate a field in jQuery</title>
<
script type="text/javascript"
src="http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.min.js">
</
script>
<
script type="text/javascript" src=
"http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js">
</
script>
<
script type="text/javascript">
$(function() {
$.validator.addMethod('AgeGrtrEighteen', function(value) {
return parseFloat(value) > 0;
}, 'Age has to be greater than 18');

$('#form1').validate({
rules: {
age: {
AgeGrtrEighteen: true
}
}
});

});
</script>
</
head>
<
body>
<
form id="form1">
<
input id="age" name="age" type="text" />
<
input id="Submit1" type="submit" value="submit" />
</
form>
</
body>
</
html>

Now when you go ahead and enter a number less than 18 or a negative number in the field and submit the form, you get a validation error message as shown below:

Custom Validation jquery

Microsoft Enterprise Library 5.0 Released

Microsoft Enterprise Library is a popular collection of reusable software components (called application blocks) designed to address common cross-cutting concerns of enterprise application developers (such as logging, validation, data access, exception handling, and more). Entlib is provided as source code, test cases, and documentation that can be used "as is" or extended, and encapsulates the Microsoft recommended and proven practices for .NET application development.

Here are some important links

Download Microsoft Enterprise Library 5.0

Microsoft Enterprise Library 5.0 Documentation

What’s New in Enterprise Library 5.0

Enterprise Library 5.0 preview at the patterns & practices summit

Find an Element based on its Style using jQuery

Here’s how to use jQuery filter to find an element based on its style

<html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
title>Find Elements based on its style</title>
<
script type="text/javascript"
src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js">
</
script>
<
style type="text/css">
.p1
{background-color:red; height:50px; width:50px; }
.p2
{background-color:blue; height:50px; width:50px; }
.p3
{ background-color:red; height:100px; width:50px; }
</style>
<
script type="text/javascript">
$(function () {
$('p').filter(function () {
return $(this).css('background-color') == 'red'
&& $(this).css('height') == '100px';
}).css('border', '2px solid black');
});
</script>
</
head>
<
body>
<
div>
<
p class="p1"></p>
<
p class="p2"></p>
<
p class="p3"></p>
</
div>
</
body>
</
html>


In the code above, we select all the paragraphs and then apply a filter based on the CSS properties set. The code adds a black border around a paragraph whose background color is red and height is 100px

image

Passing Multiple Values while using jQuery.Ajax()

I recently saw a question on the forums where the user needed to pass the value of multiple textboxes while performing an async HTTP request using $.Ajax()

Here’s how to pass the values of multiple textboxes in the $.Ajax() call. The call is being made to an ASP.NET WebMethod which accepts 3 parameters.

$.ajax({
type: "POST",
url: "Customer.aspx/GetAddress",
data: { v1: $('#tb1').val(),
v2: $('#tb2').val(),
v3: $('#tb3').val()
},
success: function(msg) {
// do something with msg
}
});

Easily Resize/Compress Images in Windows 7

A couple of days ago, I was updating my FaceBook account with the pictures I took during my TechEd 2010 visit. The images were of high resolution and there were around 120 of them. I wanted a tool that could easily resize these images.

On searching the net, I found a free tool called Image Resizer. Image Resizer is a clone of the Image Resizer Powertoy for Windows XP -- a PowerToy that allows you to right-click on one or more image files in Windows Explorer to resize them. It was created to extend support to non-XP and 64-bit versions of Windows (including 2000, Vista & 7).

After installing this power toy, all I had to do was right click on the image and choose the ‘Resize Pictures’ option

Windows 7 Image Resize

Clicking it popped up a dialog box

Windows 7 Image Resize

Then I chose the size I wanted and the results were smaller resized images! You can also select all the images in a folder and resize them at once!

Download links:

Image Resizer (32 bit)

Image Resizer (64 bit)

Silverlight 4 Training Kit

Microsoft just released a free Silverlight 4 Training Kit to get you up and running with building business applications with Silverlight 4.

Here’s an excerpt from the Channel 9 site

The Silverlight 4 Training Course includes a whitepaper that explains all of the new Silverlight 4 features, several hands-on-labs that explain the features, and a 8 unit course for building business applications with Silverlight 4. The business applications course includes 8 modules with extensive hands on labs as well as 25 accompanying videos that walk you through key aspects of building a business application with Silverlight. Key aspects in this course are working with numerous sandboxed and elevated out of browser features, the new RichTextBox control, implicit styling, webcam, drag and drop, multi touch, validation, authentication, MEF, WCF RIA Services, right mouse click, and much more!

Here’s a list of the contents in this course

What's New in Silverlight 4

Silverlight 4 New Features

Silverlight 4 Business Apps: Module 1 – Introduction

Silverlight 4 Business Apps: Module 2 - Event Manager using WCF RIA Services

Silverlight 4 Business Apps: Module 3 - User Registration with Authentication, Validation, Rich Text, Styling, and Commands

Silverlight 4 Business Apps: Module 4 - User Profile with Drop Target, Webcam, Clipboard

Silverlight 4 Business Apps: Module 5 - Schedule Planner with Grouping and Right Click

Silverlight 4 Business Apps: Module 6 - Printing the Schedule

Silverlight 4 Business Apps: Module 7 - Event Dashboard Running Out of Browser

Silverlight 4 Business Apps: Module 8 - Advanced Out of Browser and MEF

TechEd India 2010 Rocked!

Due to a tight work schedule, I had almost decided not to go to TechEd 2010 held between April 12-14 in Bangalore, India. Well not attending it would have been a big mistake!

Fortunately, my work got over in time and thanks to my MVP Lead Abhishek, he arranged an entry for me at the 11th hour. All MVP’s got a free entry to TechEd – just another reason to become an MVP :)

The event completely rocked! Keynotes, Deep Dive Sessions, Product Announcements, Product Team interactions, Contests, Free MS Exams, Giveaways, MVP Parties, Community Track by MVP’s, Partner Stalls, Demo Extravaganza and not to forget, the endless opportunities of networking with business and technology experts. This event had it all. The TechEd India team did a bang-up job to keep everything in perspective and make this event a success.

I bet most of the TechEd attendees are now ready for the next wave of technology innovations and trends. This is one grand daddy of all events no one would want to miss!

Pictures speak larger than words, so I will let some pictures do the talking now! Thanks to Arjit Basu for clicking them.

Somasegar announcing release of VS 2010 Somasegar KeynoteLeft to Right - Sumit, Nitin, Arjit and Suprotim attending the KeynoteTechEd video featuring Bill Gates Left to Right - Ashish, Arjit, Nitin, Pinal, Suprotim and Sumit at Infragistics partyRelaxing after attending the Community track Lunch with Somasegar

Check this video of MVP’s at the launch of Visual Studio 2010. I am the one at the beginning of this video wearing a Black T-Shirt and speaking about why developers should attend this event!

Microsoft TechEd India 2010 from Abhishek Baxi on Vimeo.

I am already looking forward to the next TechEd - it's sure to be a blast!

Silverlight 4 - Trim Text in a TextBlock and display Ellipses instead

What happens when you have text that does not fit its container? Let’s see.

    <Grid x:Name="LayoutRoot" Background="White" Margin="40">
<
TextBlock Name="tb" Height="20" HorizontalAlignment="Left"
Text="This sentence is too long to fit in here"
Width="100">
</
Grid>

If you run the application, you will observe that the text gets chopped off when it overflows the edge of its container.

TextTrimming Silverlight

To resolve this issue, you could either use the TextWrapping option to wrap the text or instead visually depict that the text is too big for its container. We usually depict this using the trailing three ellipsis(…)

Silverlight 4 introduces the TextTrimming property which adds an ellipses(…) when the text overflows the edge of its container. Here’s how to use this property.

    <Grid x:Name="LayoutRoot" Background="White" Margin="40">
<
TextBlock Name="tb" Height="20" HorizontalAlignment="Left"
Text="This sentence is too long to fit in here"
Width="100" TextTrimming="WordEllipsis"/>
</
Grid>

Now running the same piece of code with the TextTrimming property will produce this output with the trailing ellipses

TextTrimming Silverlight

Note: TextTrimming property was available in WPF.

5 Online Rich Text Editors built using jQuery

As defined in Wikipedia – “An Online rich-text editor presents a ‘what-you-see-is-what-you-get’ interface for editing rich text within web browsers. The aim is to reduce the learning curve associated with users trying to express their formatting directly as valid HTML markup.”

I was looking out for a few Rich Text Editors built on top of jQuery and here’s a compilation of the ones I found.

jHtmlArea - A simple, light weight, extensible WYSIWYG HTML Editor built on top of jQuery.

jQuery Rich Text Editor

markItUp - markItUp! is a JavaScript plugin built on the jQuery library. It allows you to turn any textarea into a markup editor.

jQuery Rich Text Editor

jWYSIWYG - This plugin is an inline content editor to allow editing rich HTML content on the fly.

jQuery Rich Text Editor

CSS3 jQuery Rich Text Editor - A web based rich text editor written using jQuery and CSS3 that supports embedded fonts

jQuery Rich Text Editor

HTMLBox - HtmlBox is a modern, crossÐ’ browser, interactive, openÐ’ source wysiwyg editor built on top of the excellent JQuery library

jQuery Rich Text Editor

If you know of any other editors built using jQuery, let me know via the comments section.

Visual Studio 2010 Keyboard Shortcuts Poster

You can now download the reference cards (available as print ready pdf’s) for the default keybindings in Visual Studio 2010 for Visual Basic, Visual C#, Visual C++ and Visual F# over here

Here’s a sample of the Visual C# Keyboard Shortcut Poster

image

image

image

Download them here

Silverlight 4 Released

..and the much awaited announcement is finally here! Silverlight 4 was announced by Scott Guthrie at DevConnections!

Here are some important links:

Creating Silverlight 4 applications

Here are some tools you will need to create Silverlight 4 applications:

Visual Studio 2010 or Visual Web Developer 2010 Express

Silverlight Tools RC2 for Visual Studio 2010

Expression Blend 4 RC

Silverlight 4 Toolkit (April 2010)

Note: If you have installed Silverlight 4 Beta/RC on your machine, then you have to uninstall the “Update for Visual Studio 2010 (KB976272)” from Add/Remove Programs before installing Silverlight Tools RC2.

What’s New in Silverlight 4

Here are some links that will get you started with Silverlight 4

What’s new in Silverlight 4 RC

60 minute keynote about Silverlight 4 by Scott Guthrie(@scottgu)

Silverlight – Get Started

Ensuring That Your Silverlight Applications Work with Silverlight 4

Create a 3D chart in ASP.NET 4.0

Creating a 3D chart in ASP.NET 4.0 is a cakewalk! Let us take an example of converting a simple chart to a 3D chart in ASP.NET 4.0

The chart shown below is a simple Column chart

<asp:Chart ID="Chart1" runat="server"
DataSourceID="ObjectDataSource1">
<
Series>
<
asp:Series Name="Series1"
XValueMember="Year" YValueMembers="Revenue"
ChartType="Column">
</
asp:Series>
</
Series>
<
ChartAreas>
<
asp:ChartArea Name="ChartArea1">
</
asp:ChartArea>
</
ChartAreas>
</
asp:Chart>
<
asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
SelectMethod="GetEstimates" TypeName="Estimate">
</
asp:ObjectDataSource>
 

image

To convert this chart into a 3D chart, you just need to add the Area3DStyle property inside the ChartArea object as show below:

    <ChartAreas>
<
asp:ChartArea Name="ChartArea1">
<
area3dstyle
Enable3D="True"
Inclination="10"
LightStyle="Realistic"
Perspective="15"
IsRightAngleAxes="False"
IsClustered="False" />
</
asp:ChartArea>

The result is a 3D chart.

image

With better designer skills, you can create some awesome 3D charts!

jQuery Code Snippets for Visual Studio 2010

I recently stumbled upon the jQuery code snippets for Visual Studio 2010 created by John Sheenan sometime back.

After you have downloaded the jQuery Snippets 1.0 Installer you can watch this 25 Second Demo Video to see how to use it in your apps.

You can also check out the documentation

Virtual and Physical Memory Analysis utility

I was investigating a virtual address space fragmentation issue and came across a tool called VMMap. VMMap is a process virtual and physical memory analysis utility from Sysinternals

To quote from the site “It shows a breakdown of a process's committed virtual memory types as well as the amount of physical memory (working set) assigned by the operating system to those types. Besides graphical representations of memory usage, VMMap also shows summary information and a detailed process memory map. Powerful filtering and refresh capabilities allow you to identify the sources of process memory usage and the memory cost of application features.”

If you are a developer, you should certainly download this tool to understand detailed memory usage per process and optimize your application's memory resource usage. Here’s a sample screenshot

Memory Analysis tool

Download VMMap

Visual Studio 2010 RTM and .NET Framework 4.0 Released

I am here at TechEd India 2010 and am excited to let you all know that Microsoft today released Visual Studio 2010 RTM and .NET Framework 4.0. “I am very excited to announce the availability of Visual Studio 2010 and .NET Framework 4 on April 12th”, Somasegar said.

MSDN Subscribers can download the RTM using the following links

  • Other users can purchase Visual Studio 2010 or download a trial

    If you thought this was the only exciting news for this week, then there’s more! Today during the keynote at TechEd India 2010, Somasegar announced that Silverlight 4 RTW will be available later this week along with tooling support for Visual Studio 2010

    What’s New in Visual Studio 2010?

    Here are some helpful links:

    What’s New in Visual Basic 2010, Visual C# 2010 and Visual F# 2010

    What's New in the .NET Framework 4

    What's New for Visual Studio Application Lifecycle Management 2010

    What's New in the Visual Studio 2010 Editor

    You can visit this link to get some more information on the new features added to Visual Studio 2010

    Compare different Editions of Visual Studio 2010 over here

    Backup Windows Live Writer Posts and Plugins

    I recently came across a handy utility on Codeplex called Windows Live Writer Backup (WLWBackup). WLWBackup is a backup utility for Windows Live Writer. It backs up blog settings, posts and plugins.

    image

    This tool is useful if you plan to change your machine and need to take a back up of your Live Writer. You need .NET 3.5 SP1 on this machine.

    Here is a simple tutorial that shows Backing Up and Restoring your settings, posts and plugins.

    Download the Windows Live Writer Backup version 3.0

    Open All Hyperlinks at Once using jQuery – the right way

    If you have a bunch of hyperlinks on the page and you try opening them by using $(“a”).click(), they won’t open. This is because you need to first define a click event on that element.

    Here’s a solution (shared originally by Owen) that works:

    <html xmlns="http://www.w3.org/1999/xhtml">
    <
    head>
    <
    title>Open all Hyperlinks at Once</title>
    <
    script type="text/javascript"
    src="http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.min.js">
    </
    script>
    <
    script type="text/javascript">
    $(function() {
    $("#open").click(function() {
    $("a").click();
    });

    $("a").click(function() {
    window.open($(this).attr('href'));
    });
    });
    </script>
    </
    head>
    <
    body>
    <
    a href="http://www.dotnetcurry.com">DotNetCurry</a>
    <
    a href="http://www.devcurry.com">DevCurry</a>
    <
    a href="http://www.sqlservercurry.com">SQLServerCurry</a>
    <
    input id="open" type="button" value="Open All" /><br />
    </
    body>
    </
    html>

    See a Live Demo

    You may also want to look at Convert all Links to Open in a New Page

    I will be there at TechEd India 2010

    I am glad that I will be attending TechEd India 2010. If you are attending too, make sure you drop by to say a hello! You can recognize me through my profile picture. If you are a regular visitor of my other site www.dotnetcurry.com, you must be familiar with Subodh, Shoban and Mahesh. They too will be around and would be glad to meet DotNetCurry readers!

    Microsoft Tech.Ed, the largest technology conclave, is being held in Bangalore, India between April 12-14, 2010! Tech.Ed is an amazing event that introduces you to today's cutting-edge trends and gives you a whirlwind tour of the latest Microsoft technologies.

    image

    You can follow TechEd-India on twitter. For more information visit http://www.microsoftteched.in/

    Remove Duplicate Elements from an Array using jQuery

    A very useful jQuery function is the $.unique() that removes all duplicate elements from an array of DOM elements. However this function only works on arrays of DOM elements, not strings or numbers. Thanks to an anonymous reader for pointing this out in the comments section. Here's an updated code on how to remove duplicate elements from an array of integers.

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <
    head>
    <
    title>Remove duplicate elements from array (from DevCurry.com)</title>
    <script type="text/javascript"
    src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js">
    </
    script>
    <
    script type="text/javascript">
    $(function () {
    var arr = [1, 2, 3, 2, 6, 4, 3, 7];
    $("#orig").html("Original array :" + arr.join(","));
    arr = $.unique(arr);
    $("#uniq").html("Unique array :" + arr.sort().join(","));
    });
    </script>
    </
    head>

    <
    script type="text/javascript">
    $(function () {
    var arr = [1, 2, 3, 2, 6, 4, 3, 7];
    $("#orig").html("Original array :" + arr.join(","));
    arr = arr.unique();
    $("#uniq").html("Unique array :" + arr.sort().join(","));
    });

    // Original function by Alien51
    Array.prototype.unique = function () {
    var arrVal = this;
    var uniqueArr = [];
    for (var i = arrVal.length; i--; ) {
    var val = arrVal[i];
    if ($.inArray(val, uniqueArr) === -1) {
    uniqueArr.unshift(val);
    }
    }
    return uniqueArr;
    }

    </script>
    </
    head>
    <
    body>
    <
    div>
    <
    p id="orig"></p>
    <
    p id="uniq"></p>
    </
    div>
    </body>
    </
    html>

    The Array.prototype extends the definition of the array by adding properties and methods. Here we have created a custom function called unique which removes duplicates from an array.

    Note: In case of a string array, the search is case-sensitive. So the function does not consider “Put” and “put” as duplicate

    OUTPUT

    image

    See a Live Demo

    When will my Visual Studio 2010 RC expire?

    I have been asked this question a couple of times and the answer is that Visual Studio 2010 RC expires on June 30, 2010. Microsoft saysWe will give you plenty of time after our announced April 12th launch to upgrade to final RTM bits before the RC build expires

    You can also check the number of days left for the RC to expire by going to Help > About Visual Studio

    image

    Create a XML Tree from a String

    I got a mail from a devcurry.com reader Martin this morning who asks me “I have a string containing XML tags and I need to create a XML document out of it without much efforts. Is there an easy way to do so. I can assure that the string contains valid xml

    Yes Martin, there is an easy way to do so. You have to use the XDocument.Parse() method. Here’s an example. Add a reference to System.Xml.Linq and write the following code in a console application

    C#

    static void Main(string[] args)
    {
    string str = @"<?xml version=""1.0""?>
    <Country name=""India"">
    <Capital>New Delhi</Capital>
    </Country>"
    ;
    // preserve whitespaces
    XDocument xDoc = XDocument.Parse(str, LoadOptions.PreserveWhitespace);
    Console.WriteLine(xDoc);
    Console.ReadLine();
    }

    VB.NET

    Sub Main(ByVal args() As String)
    Dim s As String = "<?xml version=""1.0""?>" & ControlChars.CrLf & _
    " <Country name=""India"">" & ControlChars.CrLf & _
    " <Capital>New Delhi</Capital>" & ControlChars.CrLf & " </Country>"
    ' preserve whitespaces
    Dim xDoc As XDocument = XDocument.Parse(s, LoadOptions.PreserveWhitespace)
    Console.WriteLine(xDoc)
    Console.ReadLine()
    End Sub

    OUTPUT

    XML document from string

    Sum of all TextBox values using jQuery

    Here’s a simple script that sums up all textbox values using jQuery. Please note that I am not using any validation here to validate the data entered. The script simply shows how to sum up textbox values.

    <html xmlns="http://www.w3.org/1999/xhtml">
    <
    head>
    <
    title>Sum of all TextBox values using jQuery</title>
    <
    script type="text/javascript"
    src="http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.min.js">
    </
    script>
    <
    script type="text/javascript">
    $(function() {
    $("#addAll").click(function() {
    var add = 0;
    $(".amt").each(function() {
    add += Number($(this).val());
    });
    $("#para").text("Sum of all textboxes is : " + add);
    });
    });
    </script>
    </
    head>
    <
    body>
    <
    input id="Text1" class="amt" type="text" /><br />
    <
    input id="Text2" class="amt" type="text" /><br />
    <
    input id="Text3" class="amt" type="text" /><br />
    <
    input id="addAll" type="button" value="Sum all Textboxes" /><br />
    <
    p id="para" />
    </
    body>
    </
    html>

    Live Demo

    Sum TextBoxes jQuery

    How to remove formatting from HTML text and display it as Plain text on a page

    The answer is by using HTMLEncoding which encodes a string and sends the resultant output to a TextWriter output stream. Here’s an example:

    C#

    protected void Page_Load(object sender, EventArgs e)
    {
    String str = "Some sample <b>string</b> to <i>test</i>";
    Response.Write("Before Encoding : " + str);
    Response.Write("<br/>");
    StringWriter sw = new StringWriter();
    Server.HtmlEncode(str, sw);
    String htmlEncStr = sw.ToString();
    Response.Write("After Encoding : " + htmlEncStr);
    }

    VB.NET

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    Dim str As String = "Some sample <b>string</b> to <i>test</i>"
    Response.Write("Before Encoding : " & str)
    Response.Write("<br/>")
    Dim sw As New StringWriter()
    Server.HtmlEncode(str, sw)
    Dim htmlEncStr As String = sw.ToString()
    Response.Write("After Encoding : " & htmlEncStr)
    End Sub

    OUTPUT

    HTML Encoding

    Programming Windows Phone 7 Series by Charlez Petzold – Free EBook

    I got excited when I heard that Charlez Petzold is authoring a Book called “Programming Windows Phone 7 Series”. To add icing to the cake, he is already offering a draft preview of his eBook FREE of cost!

    image

    This preview ebook contains six chapters in three parts (153 pages total). Get more details over here

    You can download the eBook in PDF and XPS format over here

    Programming Windows Phone 7 Series – PDF version
    Programming Windows Phone 7 Series – XPS version
    Source code

    More updates to come soon. Stay tuned!

    Visual Studio Team System 2010 - Articles

    Visual Studio Team System MVP Subodh Sohoni has been writing some amazing articles on Visual Studio Team System and Test Professional 2010. Here are some of them in case you haven’t read them already

    Visual Studio Team System 2010

    Overview of Visual Studio Team System 2010 for Developers (Part 1)

    Overview of Visual Studio Team System 2010 for Developers (Part 2)

    Overview of Team System 2010 for Architects

    Visual Studio Test Professional

    Introduction to Visual Studio Test Professional 2010

    Visual Studio Test Professional 2010: Test Case WorkItem Type

    Visual Studio Test Professional 2010: Organization of artifacts

    Visual Studio Test Professional 2010: Organization of Artifacts – Part 2

    You can also read some additional articles on Visual Studio Team System 2010 over here

    You can follow his updated via twitter over here

    Windows Phone 7 Series Developer Training Kit

    The Windows Phone 7 Series Developer Training Kit was released and can be downloaded over here

    Quoted - “This Windows Phone 7 Training Kit will give you a jumpstart into the new Windows Phone world by providing you with a step-by-step explanation of the tools to use and some key concepts for programming Windows Phones”

    Audience Prerequisites:

    This training kit is geared for beginners who want to get started with developing applications for the latest Windows Phone operating system. Even if you don’t know Silverlight or XNA Framework, you’ll find this Training Kit useful. More seasoned Silverlight developers should also find this kit useful, as it explains some of the differences between Silverlight and Silverlight for the phone.

    Here are some additional links

    Getting Started with Windows Phone

    Silverlight for Windows Phone

    XNA Framework 4.0 for Windows Phones