Sunday, October 9, 2011

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:

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