Trang web ASP.NET - Người trợ giúp
Trình trợ giúp Web giúp đơn giản hóa đáng kể việc phát triển web và các tác vụ lập trình phổ biến.
Người trợ giúp ASP.NET
Trình trợ giúp ASP.NET là các thành phần có thể được truy cập bằng một dòng mã Razor.
Bạn có thể xây dựng trình trợ giúp của riêng mình bằng cú pháp Razor được lưu trữ dưới dạng tệp .cshtml hoặc sử dụng trình trợ giúp ASP.NET tích hợp sẵn.
Bạn sẽ học cách sử dụng công cụ trợ giúp Razor trong các chương tiếp theo của hướng dẫn này.
Dưới đây là mô tả ngắn gọn về một số công cụ trợ giúp Razor hữu ích:
Trình trợ giúp WebGrid
Trình trợ giúp WebGrid đơn giản hóa cách hiển thị dữ liệu:
- Tự động thiết lập bảng HTML để hiển thị dữ liệu
- Hỗ trợ các tùy chọn khác nhau để định dạng
- Hỗ trợ phân trang (Đầu tiên, tiếp theo, trước đó, cuối cùng) thông qua dữ liệu
- Hỗ trợ sắp xếp bằng cách click vào tiêu đề cột
Người trợ giúp biểu đồ
"Trình trợ giúp biểu đồ" có thể hiển thị các loại hình ảnh biểu đồ khác nhau với nhiều tùy chọn định dạng và nhãn.
Trình trợ giúp Biểu đồ có thể hiển thị dữ liệu từ mảng, từ cơ sở dữ liệu hoặc từ tệp.
Trình trợ giúp WebMail
Trình trợ giúp WebMail cung cấp các chức năng gửi email bằng cách sử dụng SMTP (Giao thức truyền thư đơn giản).
Trình trợ giúp WebImage
Trình trợ giúp WebImage cung cấp chức năng quản lý hình ảnh trong trang web.
Từ khóa: lật, xoay, thay đổi kích thước, hình mờ.
Người trợ giúp bên thứ ba
Với Razor, bạn có thể tận dụng các trình trợ giúp tích hợp hoặc bên thứ ba để đơn giản hóa việc sử dụng email, cơ sở dữ liệu, đa phương tiện và mạng xã hội cũng như nhiều vấn đề khác như điều hướng và bảo mật web.
Phân tích (Google)
Helper | Description |
---|---|
Analytics.GetGoogleHtml( webPropertyId ) | Renders the Google Analytics JavaScript code for the specified ID. |
Analytics.GetStatCounterHtml( project , security ) | 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. |
Tiền điện tử
Helper | Description |
---|---|
Crypto.Hash( string [, algorithm] )
Crypto.Hash( bytes [, algorithm] ) | Returns a hash for the specified data. The default algorithm is sha256. |
Helper | Description |
---|---|
Facebook.LikeButton( href [,
buttonLayout] [, showFaces] [, width] [, height] [, action] [, font] [, colorScheme] [, refLabel] ) | Lets Facebook users make a connection to pages. |
Tải lên tệp
Helper | Description |
---|---|
FileUpload.GetHtml( [initialNumberOfFiles]
[ , allowMoreFilesToBeAdded] [ , includeFormTag] [, addText] [ , uploadText] ) | Renders UI for uploading files. |
Thẻ Game Thủ
Helper | Description |
---|---|
GamerCard.GetHtml( gamerTag ) | Renders the specified Xbox gamer tag. |
Tham khảo đối tượng Gravatar
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. |
Liên kếtChia sẻ
Helper | Description |
---|---|
LinkShare.GetHtml( pageTitle [,
pageLinkBack] [, twitterUserName] [, additionalTweetText] [, linkSites] ) | Renders social networking links using the specified title and optional URL. |
Mô hìnhTrạng thái
Helper | Description |
---|---|
ModelStateDictionary.AddError( key , errorMessage ) | 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. |
Thông tin đối tượng
Helper | Description |
---|---|
ObjectInfo.Print( value [, depth] [, enumerationLength] ) | Renders the properties and values of an object and any child objects. |
hình ảnh xác thực lại
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. |
Thông tin máy chủ
Helper | Description |
---|---|
ServerInfo.GetHtml() | Renders status information about ASP.NET Web Pages. |
Helper | Description |
---|---|
Twitter.Profile( twitterUserName ) | Renders a Twitter stream for the specified user. |
Twitter.Search( searchQuery ) | Renders a Twitter stream for the specified search text. |
Băng hình
Helper | Description |
---|---|
Video.Flash( filename [, width, height] ) | Renders a Flash video player for the specified file with optional width and height. |
Video.MediaPlayer( filename [, width, height] ) | Renders a Windows Media player for the specified file with optional width and height. |
Video.Silverlight( filename , width , height ) | Renders a Silverlight player for the specified .xap file with required width and height. |
Bộ đệm Web
Helper | Description |
---|---|
WebCache.Get( key ) | Returns the object specified by key , or null if the object is not found. |
WebCache.Remove( key ) | Removes the object specified by key from the cache. |
WebCache.Set( key , value [, minutesToCache] [, slidingExpiration] ) | Puts value into the cache under the name specified by key . |
Hình ảnh web
Helper | Description |
---|---|
WebImage( path ) | Loads an image from the specified path. |
WebImage.AddImagesWatermark( image ) | Adds the specified image as a watermark. |
WebImage.AddTextWatermark( text ) | Adds the specified text to the image. |
WebImage.FlipHorizontal() WebImage.FlipVertical() | Flips the image horizontally or vertically. |
WebImage.GetImageFromRequest() | Loads an image when an image is posted to a page during a file upload. |
WebImage.Resize( width , height ) | Resizes the image. |
WebImage.RotateLeft() WebImage.RotateRight() | Rotates the image to the left or the right. |
WebImage.Save( path [, imageFormat] ) | Saves the image to the specified path. |