วันนี้หยิบ Ajax Control Toolkit ตัวหนึ่ง
มาดูกัน เจ้านี่ชื่อว่า TextBoxWatermark ชื่อแปลกแหะ
TextBoxWatermark is an ASP.NET AJAX extender
that can be attached to an ASP.NET TextBox control to get "watermark" behavior.
When a watermarked TextBox is empty, it displays a message to the user with a custom CSS style. Once the user has typed some text into the TextBox, the watermarked appearance goes away. The typical purpose of a watermark is to provide more information to the user about the TextBox itself without cluttering up the rest of the page.
ใน Html จะใช้ tag library ของ ajax ดังนี้
<ajaxToolkit:TextBoxWatermarkExtender ID="WM1"
runat="server"
TargetControlID="TextBox1"
WatermarkText="Number Here"
WatermarkCssClass="csswater" />
•TargetControlID - The ID of the TextBox to operate on :
Textbox ที่ทำ Relation ด้วย
•WatermarkText - The text to show when the control has no value :
ใส่ค่า Initail Value ลงไป
•WatermarkCssClass - The CSS class to apply to the TextBox when it has no :
Style Sheet
สรุปมันคือ Mask Value Default ไว้เวลาเราไม่ได้กำหนดค่าลง Text Box นั่นเอง
แต่ถ้าเราใส่ค่าลงไป property WatermarkText ก็จะถูกแทนที่ทันที่เพื่อเอาไป process ต่อไป
ลองเอาไปใช้ดูนะครับพี่น้อง....
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
0 ความคิดเห็น:
แสดงความคิดเห็น