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:
Wednesday, January 30, 2013

How to create overloaded web methods in asp.net web service?

Recently some of colleagues were discussing about how to create overload methods in web service. We can’t directly create overloaded method web methods for web service. So I thought It would be great idea to write a blog post about it.

Function Overloading:


Function overloading is one of most known concepts of Object Oriented Programming. It’s a technique to implement polymorphism in code. Like in other programming language in c# you can also create multiple functions with same name and different argument. In function overloading function call will be resolved by ‘Best Match Technique’.

Problem: You cannot directly overload method in web service:


To understand this let’s create a simple web service with two HelloWorld Methods one with parameter and one without parameter both will return a string. Following is a code for that.
Share:
Tuesday, January 29, 2013

Visual studio 2012 color editor- Make Visual studio 2012 Colorful

This blog will be part of visual studio 2012 features series.

I personally like the Metro UI for Visual Studio 2102 but  still some people are not happy with it. They really like Old Visual Studio 2010 layout and they wanted to have same kind of color in visual studio 2012. For those who want to change the color of Visual studio there is a plug in called Visual Studio 2012 Color Theme editor. From which you can set colors for visual studio UI and make your visual studio look colorful. Following is a link for that.

http://visualstudiogallery.msdn.microsoft.com/366ad100-0003-4c9a-81a8-337d4e7ace05

Once you download that from above location and click on installer it will ask for accepting terms and conditions like following.

Install Visual studio Color editor for visual studio 2012
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