บทช่วยสอน ASP

ASP HOME

กวดวิชา WP

แนะนำหน้าเว็บ มีดโกนหน้าเว็บ เค้าโครงหน้าเว็บ โฟลเดอร์หน้าเว็บ หน้าเว็บทั่วโลก แบบฟอร์มหน้าเว็บ วัตถุหน้าเว็บ ไฟล์หน้าเว็บ ฐานข้อมูลหน้าเว็บ ผู้ช่วยหน้าเว็บ หน้าเว็บ WebGrid แผนภูมิหน้าเว็บ อีเมลหน้าเว็บ ความปลอดภัยของหน้าเว็บ เผยแพร่หน้าเว็บ ตัวอย่างหน้าเว็บ ชั้นเรียนของหน้าเว็บ

มีดโกน ASP.NET

แนะนำมีดโกน มีดโกนไวยากรณ์ มีดโกน C# ตัวแปร มีดโกน C# ลูป มีดโกน C# Logic ตัวแปรมีดโกน VB มีดโกน VB Loops มีดโกน VB Logic

ASP Classic

แนะนำ ASP ไวยากรณ์ ASP ตัวแปร ASP ขั้นตอน ASP เงื่อนไข ASP ASP วนรอบ แบบฟอร์ม ASP คุกกี้ ASP เซสชัน ASP แอปพลิเคชัน ASP ASP #รวม ASP Global.asa ASP AJAX อีเมล ASP ตัวอย่าง ASP

การอ้างอิง ASP

ฟังก์ชัน ASP VB คีย์เวิร์ด ASP VB การตอบสนอง ASP คำขอ ASP แอปพลิเคชัน ASP เซสชัน ASP เซิร์ฟเวอร์ ASP ข้อผิดพลาด ASP ASP FileSystem ASP TextStream ไดรฟ์ ASP ไฟล์ ASP โฟลเดอร์ ASP พจนานุกรม ASP ASP AdRotator ASP BrowserCap การเชื่อมโยงเนื้อหา ASP ตัวหมุนเนื้อหา ASP ASP Quick Ref

กวดวิชา ADO

แนะนำ ADO ADO Connect ชุดระเบียน ADO จอแสดงผล ADO แบบสอบถาม ADO ADO Sort เพิ่ม ADO ADO Update ADO ลบ สาธิต ADO ADO เร่งความเร็ว

วัตถุ ADO

คำสั่ง ADO การเชื่อมต่อ ADO ข้อผิดพลาด ADO ADO Field พารามิเตอร์ ADO ADO พร็อพเพอร์ตี้ บันทึก ADO ชุดระเบียน ADO ADO สตรีม ประเภทข้อมูล ADO

หน้าเว็บ ASP.NET - Helpers


Web Helpers ช่วยลดความยุ่งยากในการพัฒนาเว็บและงานเขียนโปรแกรมทั่วไป


ผู้ช่วย ASP.NET

ตัวช่วย ASP.NET เป็นส่วนประกอบที่สามารถเข้าถึงได้โดยบรรทัดเดียวของรหัสมีดโกน

คุณสามารถสร้างตัวช่วยของคุณเองได้โดยใช้ไวยากรณ์ Razor ที่จัดเก็บเป็นไฟล์ .cshtml หรือใช้ตัวช่วย ASP.NET ในตัว

คุณจะได้เรียนรู้วิธีใช้ Razor helpers ในบทต่อไปของบทช่วยสอนนี้

ด้านล่างนี้คือคำอธิบายสั้นๆ เกี่ยวกับตัวช่วย Razor ที่มีประโยชน์:


ตัวช่วย WebGrid

ตัวช่วย WebGrid ช่วยลดความยุ่งยากในการแสดงข้อมูล:

  • ตั้งค่าตาราง HTML เพื่อแสดงข้อมูลโดยอัตโนมัติ
  • รองรับตัวเลือกต่างๆ สำหรับการจัดรูปแบบ
  • รองรับการเพจ (ก่อน ถัดไป ก่อนหน้า สุดท้าย) ผ่าน data
  • รองรับการจัดเรียงโดยคลิกที่ส่วนหัวของคอลัมน์

ตัวช่วยแผนภูมิ

"ตัวช่วยแผนภูมิ" สามารถแสดงภาพแผนภูมิประเภทต่างๆ พร้อมตัวเลือกการจัดรูปแบบและป้ายกำกับมากมาย

แผนภูมิ แผนภูมิ

ตัวช่วยแผนภูมิสามารถแสดงข้อมูลจากอาร์เรย์ จากฐานข้อมูล หรือจากไฟล์


ตัวช่วยเว็บเมล

ตัวช่วย WebMail มีฟังก์ชันสำหรับการส่งข้อความอีเมลโดยใช้ SMTP (Simple Mail Transfer Protocol)


WebImage Helper

ตัวช่วย WebImage มีฟังก์ชันในการจัดการรูปภาพในหน้าเว็บ

คำสำคัญ: พลิก หมุน ปรับขนาด ลายน้ำ



ผู้ช่วยบุคคลที่สาม

ด้วย Razor คุณสามารถใช้ประโยชน์จากตัวช่วยในตัวหรือบุคคลที่สามเพื่อทำให้การใช้อีเมล ฐานข้อมูล มัลติมีเดีย และโซเชียลเน็ตเวิร์กง่ายขึ้น รวมถึงปัญหาอื่นๆ มากมาย เช่น การนำทางและความปลอดภัยของเว็บ


การวิเคราะห์ (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.

Crypto

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.

อัปโหลดไฟล์

Helper Description
FileUpload.GetHtml([initialNumberOfFiles] [, allowMoreFilesToBeAdded]
  [
, includeFormTag] [, addText] [, uploadText])
Renders UI for uploading files.

เกมเมอร์การ์ด

Helper Description
GamerCard.GetHtml(gamerTag) Renders the specified Xbox gamer tag.

การอ้างอิงวัตถุ Gravatar

Helper Description
Gravatar.GetHtml(email [, imageSize] [, defaultImage] [, rating]
  [, imageExtension] [, attributes]
)
Renders the Gravatar image for the specified email address.

เจสัน

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.

ลิงค์แชร์

Helper Description
LinkShare.GetHtml(pageTitle [, pageLinkBack] [, twitterUserName]
  [, additionalTweetText] [, linkSites]
)
Renders social networking links using the specified title and optional URL.

รุ่นState

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.

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.

ข้อมูลเซิร์ฟเวอร์

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.

วีดีโอ

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.

เว็บแคช

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.

เว็บอิมเมจ

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.