How to create Razor function in asp.net MVC View?


Function

Razor function is exactly similar to C#/vb.net methods/Function. These features came asp.net MVC 3.0 onward. Here we can write the frequently used functionality inside the function.
Here I will show how to use in Razor function in view

We have to give function syntax like this

@functions
{
// Here will be C# method
}

For calling the function Just give @MethodName

FunctionInRazor

Note: I hope you are aware of creating view in asp.net MVC.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: