Visual studio feeds

All Visual Studio blogs in one place


Enter your email address:

Delivered by FeedBurner

Increase your website traffic with



Anti-spam: How many eyes has a typical person?

Follow us on FB


JavaScript – Add Commas To Number

AddThis Social Bookmark Button

Many times when you write a number in your site you want to add commas and format the number, for example: instead of 1000000 I want to my user to see 1,000,000. Using JavaScript this is very simple task, you can also extend this code example to a Plugin inside JavaScript Lib - How To Write JavaScript \ JQuery Plugins First I’m looking for . char inside the number (we don’t want to split this…) and after that using Regex just adding comma after 3 chars. function addCommas(nStr) {
    nStr +=
    var x = nStr.split('.');
    var x1 = x[0];
    var x2 = x.length > 1 ? '.' + x[1] : '';
    var rgx = /(\d+)(\d{3})/;
    while (rgx.test(x1)) {
        x1 = x1.replace(rgx, '$1' + ',' + '$2');
    return x1 + x2;
} Example: addCommas(1000000);
// 1,000,000

// 1,234.1111

// 9,999,999.1234

// -500,000.00 ...(Read whole news on source site)

Wrong SGen For x64 Targets Used

AddThis Social Bookmark Button
This is another x64 issue where I was really surprised that it does exist. When you compile in VS2010/MsBuild a managed target for which the corresponding serialization assembly is generated you will find that all works until you try to compile for 64 bit. There you will get: "SGEN : error : An attempt was made to load an assembly with an incorrect format: xxxx.dll." Here is the 32 bit SGen is called for the 64 bit target which cannot load a 64 bit assembly. I have no idea why MS did not provide a SGen compiled as
Any CPU but the Windows SDK does bring in a 32 and 64 bit version of SGen. After a little digging around I quickly found that I can manually set the SGenToolPath MsBuild property. I could have patched C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets
directly but then I would have changed the checksum of the file and future .NET Framework patches would not be able to patch this file anymore. Since the VS 2010 project format builds completely upon MsBuild I can set the path also in my Studio project for...(Read whole news on source site)

Using QUnit with Razor Layouts

AddThis Social Bookmark Button
Given how central JavaScript is to many modern web applications,  it is important to use unit tests to drive the design and quality of that JavaScript. But I’ve noticed that there are a lot of developers that don’t know where to start. There are many test frameworks out there, but the one I love is QUnit, the jQuery unit test framework. Most of my experience with QUnit is writing tests for a client script library such as a jQuery plugin. Here’s an example of one QUnit test file I
wrote a while ago (so you know it’s nasty). You’ll notice that the entire set of tests is in a single static HTML file. I saw a recent blog post by Jonathan Creamer that uses ASP.NET MVC 3 layouts for QUnit tests. It’s a neat approach that consolidates all the QUnit boilerplate into a single layout page. This allows you to have multiple test files and duplicate that boilerplate. But there was one thing that nagged me about it. For each new set...(Read whole news on source site)

My blog post are appearing on MSDN ASP.NET MVC Content Map

AddThis Social Bookmark Button
Yesterday I was searching something and I got a nice surprise. I have seen my blog post for RSS reader is appearing on MSDN ASP.NET MVC content map. It is really proud movement for me. Following is the link from where you will get this. On this page Microsoft has created a list of best resources for ASP.NET MVC and one of my post are selected for this. Go to additional resources and there you can see my blog post
about RSS reader. I would like to take this opportunity to thank my readers. It’s all because of them. I promise that I will keep same kind of work again. I would also like to thank MSDN people for adding my blog post to their list. Thank you very very much MSDN Content creators. Hope you like it. Stay tuned for more…Till then Happy programing…
...(Read whole news on source site)

HTML 5 Input Types on WebForms Controls

AddThis Social Bookmark Button
Did you know that you can use HTML5 input types with ASP.NET WebForms controls? I wasn't sure until I tried it today: type="email" /> which properly produces this HTML5 compliant HTML output:type="email" style="width:250px;" id="Username" name="Username"> That this works shouldn't come as a big surprise since ASP.NET always has supported 'extra' attributes on Web Controls to render into the HTML. However, the input type seems like a pretty core feature in input controls and the control does have a TextMode property that already partially addresses this task. Nevertheless, explicitly specifying the type attribute allows you to override
the type and so provide custom HTML 5 input types. In short - nice! HTML5 input types are supported in WebForms without any framework changes or updates.
© Rick Strahl, West Wind Technologies, 2005-2011
Posted in ASP.NET  
...(Read whole news on source site)

HTML 5 Input Types - How useful is this really going to be?

AddThis Social Bookmark Button
HTML5 introduces a number of new input types that are meant to provide a richer user input experience. It seems like this should be a good thing, given that we've basically been stuck with a very small and limited set of stock input controls in HTML. HTML5 aims to change that with input type extensions that allow you to edit and validate special types of text input. The new input types that are available in HTML5 are the following: email url number range Date pickers (date, month, week, time, datetime, datetime-local) search color
Some of these act as validators (email, url, number) while others are meant as helpers to provide richer functionality like DataPicker, Range, Color and Search options. What do you get? A number of newer browsers now support some of the new HTML 5 input types and provide limited user hints and validation on the client. For example in FireFox 8 if I type in an invalid email address into my login dialog and tab off I get this display: and when I submit the form I get: Chrome does something similar although frankly...(Read whole news on source site)

Photo Retouching in Windows 8

AddThis Social Bookmark Button
My first attempt at a C#/XAML app on Window 8 is a photo retouching app. I tried a few different things before getting here, but I found that the C#/XAML environment is missing a lot this early on, and I didn’t want to spend too much time finding work arounds for basic tasks. Webcam integration [...]

Using Classic ASP, PHP and WebForm Pages in ASP.NET MVC Views

AddThis Social Bookmark Button

          The ASP.NET MVC framework is becoming more and more popular every day. With ASP.NET MVC 3(or upcoming ASP.NET MVC 4), you can build rich modern web applications. If you are developing an application in ASP.NET MVC then sometimes you may need to include a Classic ASP, PHP or WebForm page inside your ASP.NET MVC view for various reasons. For example, you may need to reuse the functionalities of an existing page, you may need to quickly convert a page into ASP.NET MVC, you may need to use a feature which is not directly available in ASP.NET MVC, you may need interoperability between ASP.NET MVC and other frameworks/languages, etc. In this
walk through, I will show you the possible options for including Classic ASP, PHP or WebForm page inside a ASP.NET MVC view.        Description:             This article assumes that you have already setup the IIS for running Classic ASP and PHP pages. For demonstration purpose, let's create a sample ASP.NET MVC 3 application. Next, add a HomeController with a default Index action method and a Index view in this application. Next, add a Classic ASP page(MyClassicASPPage.asp) and add the following lines inside this page,   <% Dim message message = "This is a Classic ASP Page." Response.Write (message) %>               Next, add a PHP page(MyPHPPage.php) and add the...(Read whole news on source site)