Saturday, December 24, 2011

Page methods in asp.net

Now days people are looking for richer and fluid user experience and to create that kind of application Ajax is required. There are several options available to call server-side function from JavaScript with ASP.NET Ajax and if you are using asp.net 2.0 or higher version of Microsoft.NET Framework then page methods are one of best options available to you.

Page methods are available there from asp.net 2.0. If works just like a normal web service. You can direct call that page methods directly from the JavaScript.

Let’s take a real world example. I will call java script on button client click event and then from that we call server-side function from the page methods. So let’s create a project called Pagemethods via File->New Project like following

Page methods in ASP.NET

After that I have created a page called test.aspx and now I am creating page method called GetCurrentDate like following.

using System;
using System.Web.Services;

namespace PageMethods
{
   public partial class Test : System.Web.UI.Page
   {
      [WebMethod]
      public static string GetCurrentDate()
      {
          return DateTime.Now.ToShortDateString();
      }
   }
}

As you can see in above there is  a web method called GetCurrentDate which is just returning short date in string format. Here you will notice that I have putted WebMehod attribute for that method this is a perquisite for page methods to make available in client side.

Now let’s write code for HTML and JavaScript and following is a HTML code for that.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="PageMethods.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>Page Method demo</title>
</head>
<body>
   <form id="form1" runat="server">
   <div>
       <asp:ScriptManager runat="server" EnablePageMethods="true" EnablePartialRendering="true">
       </asp:ScriptManager>

       <asp:button ID="btnGetDate" runat="server" Text="Get date from server" OnClientClick="return GetDateFromServer();"/>
   </div>
   </form>
</body>
</html>

As you can see in above code I have taken an ASP.NET button which call client side function GetDateFromServer which call page methods and get server date. Following is a javascript code for that.

<script type="text/javascript">
   function GetDateFromServer() {
       PageMethods.GetCurrentDate(OnSuccess, OnError);
       return false;
   }
   function OnSuccess(response) {
       alert(response);
   }
   function OnError(error) {
       alert(error);
   }
</script>

As you can see in GetdateFromServer methods I have called our page method Get Current date and you can see PageMethods object in JavaScript has all the methods which are available from server-side. I have passed two event handler for success and error. If any error occurred then it will alert that error and on successful response from server it will alert a current date.

So it’s now time to run that in browser.So once you pass F5 then once you click ‘Get date from server’ the output is like following as expected.

PageMethodOutput

That’s it as you see it’s very easy.Hope you like it. Stay tuned for more.Till then happy programming..

Shout it

kick it on DotNetKicks.com
Share:
Friday, December 23, 2011

Async file upload with jquery and ASP.NET

Recently before some I was in search of good asynchronous file upload control which can upload file without post back and I have don’t have to write much custom logic about this. So after searching it on internet I have found lots of options but some of the options were not working with ASP.NET and some of work options are not possible regarding context to my application just like AsyncFileUpload from Ajax toolkit.As in my application we were having old version of Ajax toolkit and if we change it than other controls stopped working. So after doing further search on internet I have found a great Juqery plugin which can easily be integrated with my application and I don’t have to write much coding to do same.

So I have download that plug from the following link. This plug in created by yvind Saltvik

After downloading the plugin and going through it documentation I have found that I need to write a page or generic handler which can directly upload the file on the server. So I have decided to write a generic handler for that as generic handler is best suited with this kind of situation and we don’t have to bother about response generated by it.

So let’s create example and In this example I will show how we can create async file upload without writing so much code with the help of this plugin. So I have create project called JuqeryFileUpload and our need for this example to create a generic handler. So let’s create a generic handler. You can create a new generic handler via right project-> Add –>New item->Generic handler just like following.

GenericHandlerForJqueryFileUploadwithASPNET

I have created generic handler called AjaxFileuploader and following is simple code for that.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;

namespace JuqeryFileUPload
{
   /// <summary>
   /// Summary description for AjaxFileUploader
   /// </summary>
   public class AjaxFileUploader : IHttpHandler
   {

       public void ProcessRequest(HttpContext context)
       {
           if (context.Request.Files.Count > 0)
           {
               string path = context.Server.MapPath("~/Temp");
               if (!Directory.Exists(path))
                   Directory.CreateDirectory(path);

               var file = context.Request.Files[0];

               string fileName;

               if (HttpContext.Current.Request.Browser.Browser.ToUpper() == "IE")
               {
                   string[] files = file.FileName.Split(new char[] { '\\' });
                   fileName = files[files.Length - 1];
               }
               else
               {
                   fileName = file.FileName;
               }
               string strFileName=fileName ;
               fileName = Path.Combine(path, fileName);
               file.SaveAs(fileName);

              
               string msg = "{";
               msg += string.Format("error:'{0}',\n", string.Empty);
               msg += string.Format("msg:'{0}'\n", strFileName);
               msg += "}";
               context.Response.Write(msg); 

              
           }
       }

       public bool IsReusable
       {
           get
           {
               return true;
           }
       }
   }
}


As you can see in above code.I have written a simple code to upload a file from received from file upload plugin into the temp directory on the server and if this directory is not there on the server then it will also get created by the this generic handler.At the end of the of execution I am returning the simple response which is required by plugin itself. Here in message part I am passing the name of file uploaded and in error message you can pass error if anything occurred for the time being I have not used right now.

As like all jQuery plugin this plugin also does need jQuery file and there is another .js file given for plugin called ajaxfileupload.js. So I have created a test.aspx to test jQuery file and written following html for that .

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="JuqeryFileUPload.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 type="text/javascript" src="jquery.js"></script>
   <script type="text/javascript" src="ajaxfileupload.js"></script>
</head>
<body>
   <form id="form1" runat="server">
   <div>
         <input id="fileToUpload" type="file" size="45" name="fileToUpload" class="input">
         <button id="buttonUpload" onclick="return ajaxFileUpload();">Upload</button>
         <img id="loading" src="loading.gif" style="display:none;">
   </div>
   </form>
</body>
</html>

As you can see in above code there its very simple. I have included the jQuery and ajafileupload.js given by the file upload give and there are three elements that I have used one if plain file input control you can also use the asp.net file upload control and but here I don’t need it so I have user file upload control. There is button there called which is calling a JavaScript function called “ajaxFileUpload” and here we will write a code upload that. There is an image called loading which just an animated gif which will display during the async call of generic handler. Following is code ajaxFileUpload function.

<script type="text/javascript">
   function ajaxFileUpload() {
       $("#loading")
   .ajaxStart(function () {
       $(this).show();
   })
   .ajaxComplete(function () {
       $(this).hide();
   });

   $.ajaxFileUpload
   (
       {
           url: 'AjaxFileUploader.ashx',
           secureuri: false,
           fileElementId: 'fileToUpload',
           dataType: 'json',
           data: { name: 'logan', id: 'id' },
           success: function (data, status) {
               if (typeof (data.error) != 'undefined') {
                   if (data.error != '') {
                       alert(data.error);
                   } else {
                       alert(data.msg);
                   }
               }
           },
           error: function (data, status, e) {
               alert(e);
           }
       }
   )

       return false;

   }
</script>

As you can see in above code I have putted our generic handler url which will upload the file on server as url parameter. There is also parameter called secureURI is required to be true if you are uploading file through the secure channel and as a third parameter we have to pass a file upload control id which I have already passed and in fourth parameter we have to passed busy indicator which I have also passed. Once we passed all the parameter then it will call a method for plugin and will return response in terms of message and error. So There is two handler function written for that.

That’s it. Our async file upload is ready. As you can easily integrate it and also it working fine in all the browser. Hope you like it. Stay tuned for more. Till then happy programming..
Share:
Thursday, December 22, 2011

Redirection in URL Routing

In one of the my earlier post I have written How easily we do URL rewriting in ASP.NET Web forms. In this post I am going to explain redirection in URL Routing.

In web application it’s a common scenario that we are redirecting our page to the one from the another and those who are familiar with the ASP.NET Web Forms will also know how we can use  Response.Redirect() to redirect from one page to another page.  In ASP.NET 4.0 Web Forms they have given same kind of Method to redirect to a particular route. The method is Response.RedirectToRoute(). With the help of this method you can redirect to any particular route. Response.RedirectToRoute() has different overload method you can find more information about it from following link.

http://msdn.microsoft.com/en-us/library/dd992853.aspx

Real Example of Response.RedirectToRoute


Iam going to use same example which I have used in my earlier post. We are going to add a new page called Index.aspx. After adding the page. I am going to add following code to global.asax to map index.aspx to launch by default.

using System;
using System.Web.Routing;

namespace UrlRewriting
{
public class Global : System.Web.HttpApplication
{

protected void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}

public static void RegisterRoutes(RouteCollection routeCollection)
{
routeCollection.MapPageRoute("RouteForCustomer", "Customer/{Id}", "~/Customer.aspx");
routeCollection.MapPageRoute("DefaultRoute", string.Empty, "~/Index.aspx");
}

}
}

As you can see in above I have added a default route to map index.aspx. Following is HTML code for index.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="UrlRewriting.Index" %>

<!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>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1>This is my home page</h1>
<asp:button ID="btnGoToCustomer" runat="server"  Text="Goto first Customer" 
onclick="btnGoToCustomer_Click"/>
</div>
</form>
</body>
</html>

As you can see in above code I have created a ASP.NET Button called for redirection and on click of that button I have written following code for that.

protected void btnGoToCustomer_Click(object sender, EventArgs e)
{
Response.RedirectToRoute("RouteForCustomer",new {Id=1});
}

As you can see in above code I have redirect it to ‘Customer' route and I am passing Id as “1” so it will load details of customer whose id is 1.

Let’s run this example via pressing F5. So it will directly load index.aspx page as homepage like following.

HomePageForURLRedirection- ASP.NET 4.0 URL Routing and revwriting

Now once you click on button It will redirect to custom page and will display customer information.

CustomerDetailsPage

So that’s it. You can see it’s very easy redirect pages with URL routing. Hope you like it. Stay tuned for more.Till then Happy programming..

Shout it
kick it on DotNetKicks.com
Share:
Sunday, December 11, 2011

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

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.

http://msdn.microsoft.com/en-us/library/gg416514%28v=VS.98%29.aspx

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.

MSDN

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…

Shout it
Share:

Easy URL routing in ASP.NET 4.0 web forms

In this post I am going to explain URL routing in greater details. This post will contain basic of URL routing and will explain how we can do URL routing in fewer lines of code.

Why we need URL routing ?

Let’s consider a simpler scenario we want to display a customer details on a ASP.NET Page so how our page will know that for which customer we need to display details? The simplest way of doing is to use query string we will pass a customer id which uniquely identifies customer in  query string. So our url will look like this.
Customer.aspx?Id=1
This will work but the problem with above URL is that its not user friendly and search engine friendly. who is going to remember that what query string parameter I am going to pass and why we need that parameter. Also when search engine will crawl this site it will going to read this URL blindly as this url is not informative because it query string is not readable for search engine crawlers. So your search engine will be ranked lower as this URL is not readable to search engine crawlers.Now when do a URL routing our URL will be cleaner shorter and simpler like this.
Customers/Id/1/
Here anybody in world can understand it talking about customer and this page will used to show customer details.Even search engine crawler will also know that you are talking about customers. That is why we need URL routing.

URL routing and ASP.NET

In earlier versions of ASP.NET we have to write lots of code for URL routing but Now with ASP.NET 4.0 you can easily route in fewer lines of code.

So let’s start a Demo where I will demonstrate you how we can easily route URLs. So let’s first create a ASP. NET web form application via File->New->Project and a dialog box will open just like below and then created a empty project called URL rewriting.

Add new project for URL rewriting in asp.net 4.0

After creating a project I have added global.asax – where we are going to write url mapping logic and then I have added an asp.net page called which will display customer information just like below.

Project for URL rewriting in asp.net 4.0

So everything is now ready let’s start writing code. First thing we need to do is to define routes. Route will map a URL to physical page.First I will create static function called Register route which map route to particular file and then I am going to call this from application_start event of global.asax. Following is code for that.

using System;
using System.Web.Routing;

namespace UrlRewriting
{
public class Global : System.Web.HttpApplication
{

protected void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}

public static void RegisterRoutes(RouteCollection routeCollection)
{
routeCollection.MapPageRoute("RouteForCustomer", "Customer/{Id}", "~/Customer.aspx");
}

}
}


Now as mapping code has been done let’s right code for customer.aspx page. I have have following code in page_load event of customer.aspx

using System;

namespace UrlRewriting
{
public partial class Customer : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string id = Page.RouteData.Values["Id"].ToString();

Response.Write("<h1>Customer Details page</h1>");
Response.Write(string.Format("Displaying information for customer : {0}",id));

}
}
}


Here in above code you can see that I am getting value from page route data and then just printing it. In real world it will fetch customer data from database and show customer details on page.

Now let’s run that application. It will print a details of customer as I have passed Id in URL suppose you pass 1 as id in URL then it will look like following.

Customer details via URL rewriting in asp.net 4.0

Now if you put 2 in url it will print information about customer 2.

Customer two details via URL rewriting in asp.net 4.0

That’s it. So we have enabled URL routing in asp.net in fewer lines of code. In next post I am going to explain redirection with URL routing.

Hope you like this post. Stay tuned for more.. Till then Happy programming

Share:
Sunday, October 9, 2011

New solution explorer feature in visual studio11 developer preview

Microsoft Visual Studio11 Developer preview comes with bunch of new features and Solution explorer is also get some new features in it. There are few new icons added at top of solution explorer like below.

Solution exploer new features in visual studio 2011-http://www.dotnetjalps.com


Create new window with copy of this Window Feature:


Now there is a one feature given with solution explorer you can create a another instance of solution explorer via clicking on last icon on solution explorer. Once you click the Last Icon for create copy. It will open a new solution explorer windows as below.

Copy solution exploer in visual studio 11-http://www.dotnetjalps.com


Properties in Solution Explorer:


Now only you can not only the see the properties of class but you can also see the methods property. Once you double-click class then it will show all methods available when you double-click method it will load the code in editor like in below.

Solution exploer properties in visual sutio11-http://www.dotnetjalps.com

Now once you click Page_load method you will see the page_load highlighted  in code editor

Highted code from solution explorer properties-http://www.dotnetjalps.com


Previous next view in solution explorer:


You can move previous and next with solution explorer. For example you have search with about like following .

SolutionExplorerContains

It will search and load About us view like following.

As you can see in above image this is About us view and you can also see that first previous button is enabled. Now once you click that it will return to default view.

Search in Solution Explorer:


Now in Solution explorer search is also provided you can search specific item in solution explorer.

SearchinSolutionsExplorer

As you can see in above image it is a incremental search so when you start typing it will start searching.
That’s it. Hope you like it. Stay tuned for more.. Till then happy programming..

Namaste!!

Shout it
kick it on DotNetKicks.com
Share:

ASP.NET MVC 4.0 Mobile Template

Microsoft has released the much awaited ASP.NET MVC 4.0 developer preview and there are lots of features bundle with it. One of the greatest features is a mobile website. Yes, Now with ASP.NET MVC 4.0 you can create mobile site also. So let’s create a simple application and let’s see how it works.

To create mobile site first you need to click File->New Project->ASP.NET MVC 4.0 Web application. Like following.

Hello world ASP.NET MVC 4.0 Mobile site-www.dotnetjalps.com

Now once you click OK it will open a new another dialog like following where we have to choose the Mobile site.

Mobile Application with asp.net mvc 4.0-www.dotnetjalps.com

As you can see in above post I have selected Razor view Once you click it will create a new application like following. As you can see similar structure as normal MVC Application application below.

ASP.NET MVC 4.0 Mobile Structure-http://www.dotnetjalps.com

This view are based on the standard jQuery Mobile. So this can be viewed in any tablet or mobile device. So if you have IPad and IPhone both then it will work on both. You need not to different application for both. see the browser first I have selected standard IPad size of browser.

Ipad

Now lets see how it look in mobile. So I have made my browser same site as mobile. As you can see its working in both.

Mobile View with ASP.NET MVC 4.0-http://www.dotnetjalps.com

If you see the code of view you can see the razor syntax over there. Nothing change in razor syntax. But as you can see in below code you need to use Jquery mobile attributes like data-Role and other stuff which will convert standard HTML into mobile or device compatible website.

<ul data-role="listview" data-inset="true">
<li data-role="list-divider">Navigation</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
</ul>

That's it. It’s very easy you can create mobile compatible site in few hours. Hope you like it. Stay tuned for more.. Till then happy programming.

Namaste!!

kick it on DotNetKicks.comShout it
Share:
Saturday, October 8, 2011

NuGet with multiple projects part-2

Before some days I have posted one post about how we can add NuGet package other than start project. In this post I am going to explain another way of doing that.

Earlier we have use ‘Manage NuGet Package’. Today I am going to use Package Manager Console for that. So let’s take same example which we have used in the earlier post. I have a sample application which have three projects.

MyApplication- Nuget with multiple projects. www.dotnetjalps.com

As you can see in above post there are three projects.
  1. MyApplication-Main Web application project
  2. MyApplication.Business- This project has business logic classes for application
  3. MyApplication.Data- This project has database access layer classes for application
Now I want to add Entity Framework MyApplication.Data Project. As we have to use Package Manager Console. We need to open package manager console you have click Tools->Library Package Manager –>Package Manager Console. Once you click that it will open a console in visual studio like following

.
PackageManagerConsole

Now as I have to type following command in NuGet Package Manager Console to install EntityFramework Package to MyApplication.Data project

Get-Project MyApplication.Data | Install-Package EntityFramework

Here in above command Get-Project will get the project where we have to install the project and Install-Package will install the required package. As you can see entityframework reference added in MyApplication.Data Project in below image.

EntityFrameworkReference

That’s it. Hope you like it. Stay tuned for more.. Till then Happy programming

Namaste!!
Share:
Friday, October 7, 2011

Beware of Plagiarism

I was checking my backlinks on sitemeter today and I have found a blog link which is directly copy my articles from my blog to his blog without giving credits to me. Following is a link for it.

http://learndotnetwithasad.blogspot.com/

This guy has copied my articles blindly event he has copied my new dotnetjalps.com domain post.  I have told this guys to remove the articles but he was not ready to remove this. So I asked Google(Blogger support) to remove content from this link. I have sent DMCA notice to blogger support via this link.

http://www.google.com/support/bin/request.py?contact_type=lr_dmca&product=blogger

After my notice Blogger support team has removed content but still this guy is copying my blog once again.
So please beware of this guy. He can copy your content too.

As a blogger we all are putting so much time to create content and other stuff. We all know that how difficult is to write something.  This blog is for community and you can copy code from here. But please don’t steal or copy my entire content from this as I have done lots of hard word for it. At least give some credits to me. That’s all I want. I hope you can understand .. Stay tuned for more.. There are so many interesting things are coming here.

Namaste!!

Shout it
Share:
Thursday, October 6, 2011

A tribute to Steve Jobs- Chairman, Apple.. A real super hero

Today I heard a sad news for techie world Apple chairman Steve Jobs passed away yesterday night. He was a great men and we would always remember him as a super hero who has brought lots innovations like iPod,iPhone and iPod etc. which changed our lives.

As Apple said on his page. “Apples has lost a visionary and creative genius,and world has lost an amazing human being. Those of us who have been fortunate enough to know and work with Steve have lost a dear friend and inspiring mentor. Steve leaves behind a company that only he could  have built and his spirit will be forever in foundation of apple”.

You can see a great image of him at http://www.apple.com like below with all product as menu like iPhone, iPod,iTunes etc. what  a men he was. My sincere  condolences to his family and Apple family. We always remember him as great men!!.

SteveJobs
“And we’ve all chosen to do this with our lives. So it better be damn good. It better be worth it.” –Steve Jobs
Shout it
Share:
Monday, October 3, 2011

First Review of ASP. NET MVC 4.0 Developer Preview

After so much buzz Microsoft has launched some of the new tools at build conference and ASP.NET MVC 4.0 Developer preview is one of them.

How I can install ASP.NET MVC 4.0 Developer preview?


There are three ways to install ASP.NET MVC 4.0 Developer preview
  1. You can download from following link-
  2. You can install ASP.NET MVC 4.0 Developer preview with web platform installer from following link-
  3. You can also install ASP.NET MVC 4.0 Developer Preview from following link-. If you don’t know about what is NuGet Package. Please visit following link of my blog.

ASP.NET MVC 4.0 and Visual Studio 2010:


There are lots of people thinking that for asp.net mvc 4.0 developer preview, you need to install Visual Studio11 Developer Preview. But that is not true.It works with both. You can also run ASP.NET MVC 4.0 developer preview with side by side with ASP.NET MVC 3.0. You can use any of above method to install asp.net mvc 4.0 developer preview on either of Visual Studio Version.
Creating ASP.NET MVC 4.0 Project with Visual Studio 2010
You can create new asp.net mvc project as same old method like File->New Project and ASP.NET MVC 4 Web Application.

ASP.NET MVC 4.0 Create Project Dialog- First Review

Once you click OK It will open a dialog where it will open a dialog like following.

Internet Application,Mobile Application with ASP.NET MVC 4.0

As you can see now there one more option for mobile application too. So this is one best thing in asp.net mvc 4.0. Now you can create mobile base application also. I will going to post about that in future posts.

Now I want to create Internet application I have selected and Clicked ‘OK’ and created new application. This will create basic mvc application. Now lets run application via F5 and it will look like following in browser.

New Template for ASP.NET MVC 4.0- First Review of ASP.NET MVC 4.0

As you can see in above image in browser Microsoft has given new template for asp.net mvc 4.0. Also there is new contact page in application. I will also going to post about this in future post.

That’s it. This was just a introduction post to ASP.NET MVC 4.0 Developer preview. There are lots of features are available in ASP.NET 4.0. I am going to explorer all this features in future posts. Hope you like it…Stay tuned for more.. Till then Happy programming.

Namaste!!

Shout it

kick it on DotNetKicks.com
Share:
Saturday, October 1, 2011

First Review of Visual Studio11 Developer Preview

Recently before some days at Build Conference on September 14,2011 Microsoft has announced release of “Visual Studio 2011 Developer Preview. You can download that from following link.

http://msdn.microsoft.com/en-us/vstudio/hh127353

I have downloaded the .NET framework 4.5 and Visual Studio11 Developer preview from the above link. First I have installed .NET Framework 4.5 like below.

Microsoft .NET 4.5 Framework Instllation for Visual Studio11 Developer preview

Once after I have installed .NET Framework 4.5. I have installed Visual Studio 11 Developer preview like following.

Installation of Visual Studio 11 Developer Preview

After installing once you load Visual Studio 11 developer preview it will look like following. It is much similar look like Visual Studio 2010.

Start Page of Visual Studio 11 Developer Preview

 

What’s new in Visual Studio11 Developer Preview:

 

There are lots of new features in Visual Studio11 Developer preview let’s go through some of new features like following.

 

Create new project template:

 

New project template is almost same except there are .NET Framework 4.5 selection is also available with other framework 3.5 and 4.0.

New Project dialog for Visual Studio 11 Developer Preview

Solution Explorer:

 

In solution explorer if you compare the stuff there are lots of new feature’s are available. You can see there are lots of Icon there in solution explorer compare to Visual Studio 2010.

Solution Explorer for Visual Studio 11 Developer Preview

Now you can do lots of things with Solution Explorer like Browsing Types,type members, search symbols and find relationship among them. I will explain them all this features in different post.

 

Quick Launch:

 

Another new feature you will notice is a Quick Launch. You can find lots of command and other stuff in visual studio from here. Suppose you want to create a new page then just type new it will give you all the options with new just like following.

Quick Lanuch Feature of Visual Studio 2011 Developer Preview

 

Line Highlighter:

 

Another things I have found is line highlighter in code editor. It will highlight the current line in Editor.

Line Highligher in Visual Studio 2011 Developer Preview

There are so many other features that needs to be discover. I will post that in future posts. Hope you liked it. Stay tuned for more..Namaste!!

Shout it
Share:
Saturday, September 24, 2011

NuGet package with multiple projects

Before some day one of my friend asked me to install NuGet in project another then startup project. At that time I don’t have any idea about it. So I did some R and D on web and found one easiest way to do it. So let’s first create a solution where we have more then one project in single solution. I have created a new solution and create three project in single solution as below.
  1. MyApplication- Main web application project.
  2. MyApplication.Business- This project contains all business logic classes of application
  3. MyApplication.Data- This project contains all data access layers classes of application
Its looks like following.

Nuget Package with multiple solutions and adding NuGet Package to more then one project

Now I want to add EFCodeFirst NuGet package to MyApplication.Data project as I want to use entity framework code first for database operations. To add new package with in the project. you can select project and then click ‘Manage NuGet Packages’ like following.

Manage Nuget Pakcage with multiple project

Once you click it will show a dialog for NuGet Packages  like following.

NuGetPacakge

I have selected EFCodeFirst and Once I clicked ‘Install’ . It has added reference to MyApplication.Data Project like following.

Entity Framework Nuget Package with multiple solution

That’s it. It’s very easy. Hope you like it..Stay tuned for more.. Till then happy programming and Namaste!!!.

Shout it
kick it on DotNetKicks.com
Share:
Search This Blog
About Me
My Photo

Full Stack Developer,Blogger,Microsoft Mvp, Mentor, Life long learner, 12+ Years of Experience for JavaScript, web and Microsoft technologies. ASP.NET MVC,Web Forms,C#,AngularJs,Golang
Mvp profile
Subscribe to my blog

Enter your email address:

Follow us on facebook
Blog Archive
Total Pageviews