Showing posts with label VisualStudio. Show all posts
Showing posts with label VisualStudio. Show all posts
Tuesday, July 17, 2012

Model binding with ASP.NET 4.5 and Visual Studio 2012

Note:I have written a whole series of Visual Studio 2012 features and this post will also be part of same series. You can get the whole list of blogs/articles from the Visual studio 2012 feature series posts there. Following is a link for that.Visual Studio 2012 feature series
In earlier version of the asp.net we have to bind controls with data source control like SQL Data source, Entity Data Source, Linq Data Source if we want to bind our server controls declaratively. Some developers prefer to write whole data access logic and then bind the data source with databind method. Model binding is something similar to asp.net mvc binding.

Model Binding in ASP.NET 4.5 and Visual Studio 2012:


With ASP.NET 4.5 and Visual studio 2012 we have a new method of binding data called ‘ Model binding’. It’s a code focus approach of data binding. Now all the controls will have ItemType property which will implement strongly type binding. The server controls will then call appropriate methods at the proper time in page life cycle and bind the data.

So what we are waiting for ? let’s take one example. First we need to create a model. For the this I have created a model class called ‘Customer’. Following is code for that.
Share:
Thursday, July 12, 2012

Free Visual Studio 2012 eBook from Telerik

Note:I have been writing lots of things about Visual Studio 2012 and this post is same in the series. You can find complete list of post from the following link.Visual Studio 2012 feature series- What’s new in Visual Studio 2012.
Visual studio 2012 is there in RC stage and I am exploring that into the great extent. Visual Studio 2012 is great editor there is no doubt. It is much more mature and comes with lots of features. Telerik – A well know in third party controls released a free eBook on Visual Studio 2012 and ASP.NET 4.5. You can find lots of time saving feature documented in this eBook.

Visual Studio 2012 feature list - What's new in Visual Studio 2012

Following is a quick list of features they have explored in Visual Studio 2012.
  1. JavaScript Intellisense
  2. CSS Intellisense
  3. ASP.NET and ASP.NET Web API
  4. Strongly typed data binding
  5. Page Inspector(new Debugging Tool)
  6. HTML5 and CSS3 is available out of box
  7. Request validation prevents yellow screen of death
  8. WAI Aria makes the web usable by all
Share:
Tuesday, July 3, 2012

Event handler generation in Visual Studio 2012

Note: This post will be a part of Visual Studio 2012 feature series.
There are lots of new features there in visual studio 2012. Event handler generation is one of them. In earlier version of visual studio there was no way to create event handler from source view directly.  Now visual studio 2012 have event handler generation functionality.

So if you are editing an event view in source view intellisense will display add new event handler template and once you click on it. It will create a new event handler in the cs file. It will also put a eventhandler name against event name so you don’t need to write that.

So, let’s take a simple example of button click event so once I write onclick attribute their smart intellisense will pop up
.
Event handler generation in visual studio 2012 - What's new in visual studio 2012

Now once you click on <Create New Event> It will create event handler in .cs file like following.
Share:
Monday, July 2, 2012

Multiple file upload with asp.net 4.5 and Visual Studio 2012

Note: This post will be part of Visual Studio 2012 feature series.
In earlier version of ASP.NET there is no way to upload multiple files at same time. We need to use third party control or we need to create custom control for that. But with asp.net 4.5 now its possible to upload multiple file with file upload control.

With ASP.NET 4.5 version Microsoft has enhanced file upload control to support HTML5 multiple attribute. There is a property called ‘AllowedMultiple’ to support that attribute and with that you can easily upload the file. So what we are waiting for!! It’s time to create one example.
On the default.aspx file I have written following.

<asp:FileUpload ID="multipleFile" runat="server" AllowMultiple="true" />
<asp:Button ID="uploadFile" runat="server" Text="Upload files" onclick="uploadFile_Click"/>

Here you can see that I have given file upload control id as multipleFile and I have set AllowMultiple file to true. I have also taken one button for uploading file.For this example I am going to upload file in images folder. As you can see I have also attached event handler for button’s click event. So it’s time to write server side code for this. Following code is for the server side.

protected void uploadFile_Click(object sender, EventArgs e)
{
    if (multipleFile.HasFiles)
    {
        foreach(HttpPostedFile uploadedFile in multipleFile.PostedFiles)
        {
            uploadedFile.SaveAs(System.IO.Path.Combine(Server.MapPath("~/Images/"),uploadedFile.FileName));
            Response.Write("File uploaded successfully");
        }
    }
}

Share:
Sunday, July 1, 2012

Quick tour of visual studio 2012 features so far

Note: I am writing a whole new feature series about Visual Studio 2012 new features. Following is the link for that. I have written couple of post there.Visual Studio 2012 features series. What's new in Visual Studio 2012
I thought it would be great idea to write summary post for this. So this post will be a summary of all the post I have written so far. Here it will describes what’s new in visual studio 2012 and what are the features that I have covered so far. It will be quick of tour of some of the feature in Visual Studio 2012.

Visual studio 2012 first review(Earlier known as Visual studio 2011 beta)


In this post, I have written about the Metro UI of visual studio 2012. It’s totally different then the older version of visual studio 2012. Now its empathize more on code instead of visual appealing things. In this blog post I have also described solution explorer and tool box features also. Following is a link for that.

Visual Studio 2011 Beta First Review(Now known as Visual Studio 2012)

Project dialog box changes in visual studio 2012


In this post, I have written about Project dialog box changes and also written about new project templates which are included in the project dialog like ‘Portable Class Library’. I have also explained some of new other additions in project template like ‘Light switch category’ and ‘Coded UI test project’ in visual studio 2012. Following is a link for that post.
Share:
Wednesday, June 27, 2012

Bundling in visual studio 2012 for web optimization

Note: I have been writing a series of posts about Visual Studio 2012 features. This series describes what are the new features in the Visual Studio 2012. This post will also be part of Visual Studio 2012 feature series.
As we know now days web applications or site are providing more and more features and due to that we have include lots of JavaScript and CSS files in our web application.So once we load site then we will have all the JavaScript  js files and CSS files loaded in the browsers and If you have lots of JavaScript files then its consumes lots of time when browser request them.
Following images show the same situation over there.

Bundling feature in Visual Studio 2012 - Visual Studio 2012 feature series

Here you can see total 25 files loaded into the system and it's almost more than 1MB of total size. As we need to have our web application of site very responsive and need to have high performance application/site, this will be a performance bottleneck to our site. In situation like this, the bundling feature of Visual Studio 2012 and ASP.NET 4.5 comes very handy. With the help of this feature we do optimization there and we can increase performance of our application.
Share:
Thursday, June 21, 2012

Color indication in Visual Studio 2012

Note: This post will be a part of Visual Studio 2012 series.
Before some days Microsoft has released the release candidate version of Visual Studio 2012. Today I got installed Visual Studio 2012 and once I loaded the visual studio 2012 first things I noticed that there is purple color blank strip is there at bottom. After doing some R and D on internet I have found that it is used for the different indication. The purple color indicates that there is no project loaded now.

Color Indication in visual studio 2012 Purple color for no project
Share:
Thursday, May 24, 2012

Extract to User Control in visual studio11

Note: This post will be part of Visual Studio 2012 feature series. As Visual studio 2011 beta is now known as Visual Studio 2012
I have been playing with Visual Studio 11 beta recently and everyday I am amazed with new features of it. Today I have found one more very useful feature Extract to User Control feature.

In large projects, we are having large pages and its always good to use  user control(.ascx) but sometimes we are so lazy to create user controls and we remain with the whole page and even we can’t reuse that code. In similar kind of situation ‘Extract to user control’ can be quite useful. Suppose we have long HTML mark up and we need to convert one div to user control and then we can do it very easily with Visual Studio 11 beta Extract to User Control feature.

You just need to select code you want there in user control and then you need to right click and click ‘Extract to User Control’ like below.

Extract to user control feature- What's new in visual studio 11 features
Share:
Wednesday, May 23, 2012

Browser selection in Visual Studio 11

This blog post will be a part of Visual Studio 2012 features series. As now Visual Studio 2011 beta know as Visual Studio 2012.

In the earlier version of the Visual Studio if you want to run your page in browser then you have to do it with view in browser. But now you have directly that on the Visual studio 2012 toolbar like below.

Visual Studio 2011 beta Broswer selection toolbar

Share:
Thursday, May 10, 2012

Image preview in solution explorer Visual Studio 2011 beta

Note: This post will be part of Visual Studio 2012 feature series. As Visual Studio 2011 beta is known as Visual Studio 2012.

Everyday I am using Microsoft Visual Studio 2011 beta and everyday I learn some cool feature of it. In today’s post I am going to explain one cool features of Visual Studio 2011 beta solution explorer. As a web developer we all want to see the image preview in solution explorer and visual studio 2011 beta is now having it. We can see image preview in solution explorer just like following.
Share:
Tuesday, May 8, 2012

Css Enhancement in Visual Studio 2011 beta

Note:This blog post will be part of Visual Studio 2012 feature series.As now visual studio 2011 beta is known as Visual Studio 2012.
In this post we are going to look at some of CSS enhancement features in Visual Studio 2011 beta. First thing you notice in Visual Studio 2011 is better intellisense for the CSS. Now same kind of intellisense are available which we are using for C# and other languages.

Better CSS Intellisense in Visual Studio 2011 Beta- Features of Visual Studio 2011

Another enhancement is color selection Visual Studio 2011 beta. Now it’s provides a Great Color picker to choose CSS colors as you want. You don’t have to rely on the Hexadecimal value for color.

image

Commenting and uncommenting in CSS is now very easy and can you with formatting toolbar like following.

Commenting and uncommenting features in Visual Studio 2011 beta

That’s it. Hope you liked it. Stay tuned for more..Till than happy programming.
Share:
Sunday, May 6, 2012

Go to definition in JavaScript feature of Visual Studio 2011 beta

Note: Now Visual Studio 2011 beta is officially released as Visual Studio 2012. So it will be part of Visual Studio 2012 series.

In recent days I am exploring the Visual studio features and this blog post is also part of that. I am loving visual studio 2011 beta more and more after exploring features that make developer’s life easy. Today I am going to talk about one of the features that is going to make developer’s life easy.

JavaScript is a client scripting language which is an integral part of any web application now days.  So if you are web application developer you are surely going to write lots of JavaScript those days.  With earlier version of visual studio navigating code in JavaScript is not easy. But in visual studio 2011 beta we have go to definition features which one of most favourite features of visual studio for visual C#.
Share:
Saturday, May 5, 2012

Project Dialog in Visual Studio 2011 beta

This post will be a part of the Visual Studio 2012 Feature Series. As now visual studio 2011 beta is known as Visual Studio 2012 .
Today we are going to look at the New project dialog and some other improvements in visual studio 2011 beta. New project dialog comes with streamlined metro style icons of the project and looks beautiful. You can see some new project templates like portable class library which is a project template for creating dlls which can run on the windows,Silverlight and windows phone 7 and Xbox 360 just like following.
Share:
Friday, May 4, 2012

Visual Studio 2011 Beta First Review.

Note:This post be a part of Visual Studio 2012 feature series. As know Visual Studio 2011 beta known as Visual Studio 2012.

Before some days Microsoft has release visual studio 2011 beta and I have started playing with it. Have you played with it yet? If not then this series of post is for your.

I am basically a developer by heart. So out of latest offering from Microsoft  I am concentrating more on Visual studio 2011,ASP.NET 4.5,C# new features and ASP.NET MVC 4. So here we got let’s load visual studio 2011 beta.
Share:
Saturday, April 14, 2012

Full screen in Visual studio 2010

Visual studio is a great IDE and I am learning everyday something new and I have found one great feature today which is available from the Visual studio 2008. So I thought it would great to be share with all you guys.

We all like to have most portion of screen to cover code part so we can view all the lines and we don’t have to use page and page down keys to navigate through code. You can have visual studio in full screen mode with View->Full Screen or via pressing Shift + Alter + Enter as shortcut..
Share:
Sunday, January 29, 2012

My first video for code refactoring in visual studio 2010

I have been planning this since long but now Its happened. I have created a video for visual studio 2010 code refactoring features. I have made this video public. Following is a link for that.

http://www.youtube.com/watch?v=HvC63rE7tB4&feature=share

Here is the video..


Please see the video and let me know your feedback. I am not a trained professional in this but I have tried to create it. Hope fully I will master this technique in some time. Stay tuned for more. Till then Happy
programming.

Shout it

kick it on DotNetKicks.com
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:
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:
Sunday, August 28, 2011

Visual Studio 2010 Features post list on my blog

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