Wednesday, February 27, 2013

Internet explorer 10 for windows 7- What’s new

Recently before some time Scott Hanselman just announced Internet Explorer 10 for windows 7. Today it’s launch and I have just downloaded the and installed it. I thought you it would be  a great idea to write a blog post about this.

Download Internet explorer 10 for windows 7:

The first question comes to your mind that from where we can download internet explorer 10. Following is a link for that from where you can download the IE 10 for windows 7.

http://windows.microsoft.com/en-us/internet-explorer/downloads/ie-10/worldwide-languages

Installation went very smooth You just need to restart the computer once IE 10 completely installed.

Share:
Sunday, February 24, 2013

HTML editor enhancement in visual studio 2012

In this post I am going to explain about HTML Editor Enhancement in visual studio 2012. I have been writing few post about Visual studio 2012 new features and this post will also be part of that. You can read whole series at following link.

Visual Studio 2012 feature series

Tag highlighting in Visual Studio 2012:

In visual studio 2012 You can highlight the start and end tag of a particular HTML element. One you click on starting tag of HTML element it will have other part highlighted just like following.

HTMLTagHighLightVisualStudio2012
Share:
Saturday, February 23, 2013

Dotnetjalps.com- 551 blog posts and still counting!!

Today is one of the most important day for this blog as I am writing 551th blog post for this blog post. I can’t believe this..yeah this blog has completed 550 blog post.

People I like to thank:

First of all I like to thank my parents for whatever I am without them I could not even stand near where I am right now!!.  Then I would like to thank my wife without her support it would not have been possible to write this 551 blog post..So thank you sweetheart. My younger brother who has been moral support for me whenever I feel low or something was not working my way. My little champ who give me all energy that I have. Whole MVP community and friends where I learn so many things and off course readers of this blog. Without readers this blog is not there where it is right now!!

How I started blogging:

Actually  I was not serious about blogging I just show a blog with blogspot domain and for curiosity I have also registered a blog actually at that time I have registered it with my name like http://jalpesh.blogspot.com. At that time I have no idea that what blog is. After registering blog for first month I have not done anything and one one day I just goggled my name and I found my blog listing over there even if I have not written anything. I feel excited and decided I should write some thing and that’s how I have started writing.

Earlier I was just writing blog posts to make a repository of my code whatever I have done in my professional life. But when I came Ahmedabad at that time I understand the true value of blog and then I started taking it very seriously and started writing blog post that can help others and me to learn new things.

Then I brought my own domain last year http://www.dotnetjalps.com to create my own brand.

This blog is my journey of learning and I believe in this journey and continue to walk on it that’s why I have made title of this blog post still counting!!
Share:
Thursday, February 14, 2013

Default keyword in c#

In this post, I am going to explain about default keyword in c#.

Introduction:

As per MSDN default keyword in C# used to assign the default value of the type. In some situation its comes very handy where we don’t want to create object and directly assign the default value of it.

The basic syntax of default is default(T) where t is any reference type of value type and If T is a value type, whether it will be  a numeric value or struct.

Default Keyword usage:

We can use Default keyword in variety of cases.

Assigning value to nullable Type:


We can use it to assign default value to nullable types like below.
using System;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main() {
            int? i = default(int);
            Console.WriteLine(i);
        }
    }
}

Here output will be.
Share:
Wednesday, February 13, 2013

How to convert a list into array with Linq

In this post, I am going to explain how we can convert an generic list to simple int array with Help of Linq. Recently, I was working on an application and there I needed an Int array of for list of ids in generic list. I tried various methods and then with the help of ‘Select’ operator and ToArray method I have easily converted an generic list to the int array.

Lets take a simple example. I need a contact id list from a generic list of contacts and following is my contact class.

public class Contact
{
    public int ContactId { get; set; }
    public string Name { get; set; }
}

Now I have created a new GetContacts methods to create a new Generic List of Contacts.
Share:
Thursday, February 7, 2013

Redirection with ASP.Net friendly URLs

In this post we are going to see how we can use Response.Redirect(Redirecttion) in asp.net friendly URLs. Before some day I have written a post about ASP.NET Friendly URLs – Cleaner, SEO friendly URLs. On that post one reader ‘Ramesh’ asked me that how we can do redirection with ASP.Net friendly URLs. So this post is in reply to Him.

How to redirect a page to ASP.Net friendly URLs:

Actually!! there is nothing to learn. It’s very easy You can directly use the ‘Response.Redirect’ with the ASP.Net friendly URLs. The NuGet Package itself takes care of all the things. You just need to write the route name as a parameter in ‘Response.Redirect’ and you are done!!

Uh!! don’t believe me!!. Let’s take a sample example. I am going to use by default template with ASP.NET Friendly URLs.  So for this example I have created a ASP.Net button in Default template AboutUs.aspx page. Once the click of that button we are going to use ‘Response.Redirect’ for redirection and redirect this page to Contact Page. Following is a html code for that button.
Share:
Monday, February 4, 2013

ASP.NET Friendly URLs – Cleaner, SEO friendly URLs

Search Engine optimization is one of the key factor for your site. If you spend millions of dollars on making your website looks good and bug free then also its possible that you will not get attention of search engine because of your URLs.  For example you’re having shopping cart created in asp.net and you have not optimized your URL then it will look like following.

www.foo.com ?Product.aspx?Category=1& Page=1

If you search engine read this URL then search engine will not know much about this URLs. Even normal people  who does not know querystring menaing(?Category=watch&Page=1) will not understand it. But If you have URL like following.

www.foo.com/prduct/category/watch/page/1

It’s easy to read and search engine and normal people will know that you are loading products that belongs to category watch and this is a first page.
Share:
Sunday, February 3, 2013

What’s new in ASP.NET and Web Tools 2012.2 Release Candidate

Recently before some time, Scott Gu announced ASP.NET and Web Tools 2012.2 Release Candidate. I have downloaded it and used it for a while and I have found following new things.

ASP.NET Enhancements:

  • New facebook asp.net mvc template is  there. Creating facebook application with asp.net mvc become very easy. In just a few step you can easily create facebook application and get data of users and friends of facebook.
  • Real Time Signal R support is there. You can easily create chat kind of applications with it. You can also take advantage of new web socket in .NET 4.5.
  • New updates with ASP.NET WEB Api now supports OData, Integrated tracing and automatically generating help document for your api
  • ASP.NET Friendly URLs: This feature makes developers life very easy with creating SEO friendly and cleaner looking URLs with out .aspx extension. The Friendly URLs feature also makes it easier for developers to add mobile support to their applications with support for mobile .ASPX pages and  supporting switching between desktop and mobile views.  It can be used with existing ASP.NET v4.0 applications
  • Enhancement to Web publishing
  • All new single page application template with knock out JavaScript library and restful UI.
Share:
Saturday, February 2, 2013

How to hide title bar in jQuery UI modal dialog?

jQuery UI is a great open source set of user controls and it’s very easy to use. Recently one of my friend asked question that how we can hide title bar in jQuery UI Dialog? so this post is a reply to him. Let’s create a simple html and use jQuery Ui modal dialog. Following is a code for that.

Here in the above code you can see I have create a hello world pop up with asp.net jQuery CDN.
<html>
<head>
    <title>Hello World  Popup</title>
    <link type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.0/themes/smoothness/jquery-ui.css"
        rel="stylesheet" />
    <script language="javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.0.min.js"></script>
    <script language="javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.0/jquery-ui.min.js"></script>
    <script type="text/javascript">
        function Show() {

            $("#dialog:ui-dialog").dialog("destroy");

            $("#dialog-modal").dialog({
                height: 300,
                width: 200,
                modal: true
            });
        }
    </script>
</head>
<body>
    <div id="dialog-modal" title="Hello Word" style="display: none">
        Hello World Juqry UI popup
    </div>
    <input type="button" onclick="javascript: Show()" value="click me" />

</body>

</html>


Share:

How to create overload methods in WCF service with C#

Before some days I have posted an blog about How to create overloaded web methods in asp.net web service? In this post I am going to explain how we can create overload methods in WCF(Windows Communication Foundation) service with C# language.

So let’s consider same Hello world example which we have used web service overload method. Let’s create two methods HelloWorld one is with name and another is without parameter. For WCF service we have to first create interface following is a code for that.
Share:
Friday, February 1, 2013

Getting started with Twitter Bootstrap and ASP.Net MVC


Update: Now with ASP.NET MVC5 you don't need to install twitter bootstrap nuget package now its by default available with default template.

In this blog I am going explain how we are  going integrate Twitter Bootstrap library with ASP.Net MVC.

What is Twitter bootstrap:

Twitter Bootstrap is open source library created by Twitter. As per twitter it’s Sleek, intuitive, and powerful front-end framework for faster and easier web development. It’s full featured framework for creating web sites. It includes CSS framework, JavaScript, JavaScript plug-ins,typography, Html scaffolding. There are lots of themes also available that are available so you can use that right away.

Integrating Twitter bootstrap with ASP.Net MVC:

Earlier we have to manually integrate Twitter bootstrap into the ASP.NET MVC like here. But now We have Twitter.Bootstrap.MVC4 Nuget packages that saves lots of time to adding bootstrap to MVC4 template. It’s very easily combines bootstrap into ASP.NET MVC application thanks  to it’s authors Matt Hinze and Eric Hexter.

As per Eric Hexter It’s provide following features.
  • JS and CSS bundling/minification of Twitter Bootstrap files the MVC4 way
  • Incorporate a jQuery validation fix to work with the bootstrap javascript
  • Razor Layout templates using Twitter Bootstrap markup.
  • Menus using Navigation Routes, including submenus and hiding menus by context(logged in vs anonymous)
  • Runtime Scaffolding – default Index, Edit and Detail views.. You provide thePOCOs and we will render the CRUDviews.
  • Post Redirect Getsupport using the Bootstrap Alert styles.
  • A Sample to show how to use all of this stuff
Share:

SelectMany operator in Linq C#

SelectMany is an important operator in Linq. It takes each element of a sequence to an IEnumerable and flattens the resulting sequences into one sequence. You can find out more information about different overload list from the below link.

http://msdn.microsoft.com/en-us/library/system.linq.enumerable.selectmany.aspx

In this post I am going to explain How it can be really useful when you want to find list related to two entities. Practical example will be like a person can have multiple address and if you want to find list of addresses that are used with person then this SelectMany operator can be really useful.

So for this example First, I have create Address class with Street and Postalvcode property
public class Address
{
    public string Street { get; set; }
    public string PostalCode { get; set; }
}

Share:

Support this blog-Buy me a coffee

Buy me a coffeeBuy me a coffee
Search This Blog
Subscribe to my blog

  

My Mvp Profile
Follow us on facebook
Blog Archive
Total Pageviews