ASP.NET Web Pages - Helpers

Web Helpers greatly simplifies web development and common programming tasks.


ASP.NET Helpers

ASP.NET helpers are components that can be accessed by single lines of Razor code.

You can build your own helpers using Razor syntax stored as .cshtml files, or use built-in ASP.NET helpers.

You will learn how to use Razor helpers in the next chapters of this tutorial.

Below is a short description of some useful Razor helpers:


The WebGrid Helper

The WebGrid helper simplifies the way to display data:

  • Automatically sets up an HTML table to display data
  • Supports different options for formatting
  • Supports paging (First, next, previous, last) through data
  • Supports sorting by clicking on column headings

The Chart Helper

The "Chart Helper" can display chart images of different types with many formatting options and labels.

 chartchart

The Chart helper can display data from arrays , from databases, or from files.


The WebMail Helper

The WebMail helper provides functions for sending email messages using SMTP (Simple Mail Transfer Protocol).


The WebImage Helper

The WebImage helper provides functionality to manage images in a web page.

Keywords: flip, rotate, resize, watermark.



Third Party Helpers

With Razor you can take advantage of built-in or third party helpers to simplify the use of email, databases, multimedia, and social networks as well as many other issues like navigation and web security.


Analytics (Google)

Helper

Description

Analytics.GetGoogleHtml(webPropertyId)

Renders the Google Analytics JavaScript code for the specified ID.

Analytics.GetStatCounterHtml(projectsecurity)

Renders the StatCounter Analytics JavaScript code for the specified project.

Analytics.GetYahooHtml(account)

Renders the Yahoo Analytics JavaScript code for the specified account.


Bing

Helper

Description

Bing.SearchBox([boxWidth])

Passes a search to Bing. To specify the site to search and a title for the search box, you can set the Bing.SiteUrl and Bing.SiteTitle properties. Normally you set these properties in the _AppStart page.

Bing.AdvancedSearchBox([, boxWidth] [, resultWidth] [, resultHeight]
  [, themeColor] [, locale]
)

Displays Bing search results in the page with optional formatting. To specify the site to search and a title for the search box, you can set the Bing.SiteUrl and Bing.SiteTitle properties. Normally you set these properties in the _AppStart page.


Crypto

Helper

Description

Crypto.Hash(string [, algorithm])
Crypto.Hash(bytes [, algorithm])

Returns a hash for the specified data. The default algorithm is sha256.


Facebook

Helper

Description

Facebook.LikeButton(href [, buttonLayout] [, showFaces] [, width] [, height]
[, action] [, font] [, colorScheme] [, refLabel]
)

Lets Facebook users make a connection to pages.


FileUpload

Helper

Description

FileUpload.GetHtml([initialNumberOfFiles] [allowMoreFilesToBeAdded]
  [
includeFormTag] [, addText] [uploadText])

Renders UI for uploading files.


GamerCard

Helper

Description

GamerCard.GetHtml(gamerTag)

Renders the specified Xbox gamer tag.


Gravatar Object Reference

Helper

Description

Gravatar.GetHtml(email [, imageSize] [, defaultImage] [, rating]
  [, imageExtension] [, attributes]
)

Renders the Gravatar image for the specified email address.


Json

Helper

Description

Json.Encode(object)

Converts a data object to a string in the JavaScript Object Notation (JSON) format.

Json.Decode(string)

Converts a JSON-encoded input string to a data object that you can iterate over or insert into a database.


LinkShare

Helper

Description

LinkShare.GetHtml(pageTitle [, pageLinkBack] [, twitterUserName]
  [, additionalTweetText] [, linkSites]
)

Renders social networking links using the specified title and optional URL.


ModelState

Helper

Description

ModelStateDictionary.AddError(keyerrorMessage)

Associates an error message with a form field. Use the ModelState helper to access this member.

ModelStateDictionary.AddFormError(errorMessage)

Associates an error message with a form. Use the ModelState helper to access this member.

ModelStateDictionary.IsValid

Returns true if there are no validation errors. Use the ModelState helper to access this member.


ObjectInfo

Helper

Description

ObjectInfo.Print(value [, depth] [, enumerationLength])

Renders the properties and values of an object and any child objects.


Recaptcha

Helper

Description

Recaptcha.GetHtml([, publicKey] [, theme] [, language] [, tabIndex])

Renders the reCAPTCHA verification test.

ReCaptcha.PublicKey
ReCaptcha.PrivateKey

Sets public and private keys for the reCAPTCHA service. Normally you set these properties in the _AppStart page.

ReCaptcha.Validate([, privateKey])

Returns the result of the reCAPTCHA test.

   

ServerInfo

WebPages Helpers
Login
ADS CODE