Monday, April 9, 2012

Creating dynamic breadcrumb in asp.net mvc with mvcsitemap provider

I have done lots breadcrumb kind of things in normal asp.net web forms I was looking for same for asp.net mvc. After searching on internet I have found one great nuget package for mvpsite map provider which can be easily implemented via site map provider. So let’s check how its works. I have create a new MVC 3 web application called breadcrumb and now I am adding a reference of site map provider via nuget package like following.
Share:
Saturday, April 7, 2012

Execute TSQL statement with ExecuteStoreQuery in entity framework 4.0

I was playing with entity framework in recent days and I was searching something that how we can execute TSQL statement in entity framework. And I have found one great way to do that with entity framework ‘ExecuteStoreQuery’ method. It’s executes a TSQL statement against data source given enity framework context and returns strongly typed result.

You can find more information about ExcuteStoreQuery from following link.
http://msdn.microsoft.com/en-us/library/dd487208.aspx

Share:
Wednesday, April 4, 2012

Ternary operator in VB.NET

We all know about Ternary operator in C#.NET. I am a big fan of ternary operator and I like to use it instead of using IF..Else. Those who don’t know about ternary operator please go through below link.

http://msdn.microsoft.com/en-us/library/ty67wk28(v=vs.80).aspx

Here you can see ternary operator returns one of the two values based on the condition. See following example.
Share:

How to pad number with leading zero with C#

Recently I was working with a project where I was in need to format a number in such a way which can apply leading zero for particular format. So after doing such R and D I have found a great way to apply this leading zero format.

I was having need that I need to pad number in 5 digit format. So following is a table in which format I need my leading zero format.

1-> 00001
20->00020
300->00300
4000->04000
50000->5000

So in the above example you can see that 1 will become 00001 and 20 will become 00200 format so on. So to display an integer value in decimal format I have applied interger.Tostring(String) method where I have passed “Dn” as the value of the format parameter, where n represents the minimum length of the string. So if we pass 5 it will have padding up to 5 digits.
Share:
Tuesday, March 27, 2012

Important Mile stone achieved–I got 4,00,000 visitors for my blog

I have written this blog more than 5 years now and today I got one great news from sitemeter.com that I have achieved 4,00,000 visitors milestone. I would like to take this opportunity to thanks all the my readers for everything. I got nice appreciations from people around me and that’s encourage me to write more blogs.
Following is a screenshot of my blog statistics from sitemeter.com.
Share:
Saturday, February 4, 2012

Number- New HTML5 Input type

I have been writing few series of new HTML5 input types and this is another post on same series. In this post I am going to explain Number input types. The number type is for numeric values. When you use number input type it will have spinner with up and down arrow and with the help of this you can increase or decrease of value.

Attributes of Number Input type:

There are four attributes of Number input types.
  1. Value : This attribute is used to specify the default value of the input type once its first loaded. So what ever you put there in input value it will be there.
  2. Min: As name suggest it defines minimum value for a range that you can you can choose in number input types.
  3. Max: It defines maximum number value for the range a number input type can have.
  4. Step: This attribute defines the number which will decrease or increase number value. If you don’t specify the value for it the default value for this will be 1.
Share:

URL–New HTML5 input element

In earlier post we have seen how the email input tag work in the browser. HTML5 comes with lots of new goodies and today we are going to see one of another new html5 input types URL.

In most of the sites once you fill your contact and personal information it will ask for your URL. Till now there is no specific type for URL and we have to manually validate the URL with the Java Script but now with the HTML5 you don’t have do that. It will automatically validate the URL. For the browsers that are not supporting this will work as normal input text box.

So let’s take a simple example of URL input type. I am going to use same ASP.NET MVC project that I have used for the earlier post. So Here is the code for that.
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