Category Archives: ASP.net+VB

SelectedItem.Value vs SelectedValue

เคยสงสัยมั้ยว่า SelectedItem.Value กับ SelectedValue ต่างกันอย่างไร ทั้งสองคำสั่ง ล้วนเป็นคำสั่งที่ใช้ในการดึงค่าออกมาจาก control ใน .net framework เช่น dropdownlist, radiobuttonlist เป็นต้น แต่ – SelectedValue จะ return เป็นค่าของ SelectedItem ดังนั้นถ้าไม่มีค่าก็จะแสดงเป็นค่า “” – SelectedItem.Value จะ return เป็นค่าของ item ที่ถูก select ดังนั้นถ้าไม่มี item ที่ถูก select จะ error

Categories ASP.net+VB, Computer Tags , commentLeave a comment

[ASP.net+VB] การทำ Select All / Unselect All ใน GridView

หลังจากคราวที่แล้ว ได้ทำการสร้าง CheckBox ใน GridView เพื่อแสดงข้อมูลจากฐานข้อมูลแล้ว [ASP.net+VB] สร้าง CheckBox ใน GridView มาคราวนี้ ก็จะมาเพิ่มเติมลูกเล่นให้กับ GridView โดยที่ Header ของ GridView นี้ จะให้สามารถ Select All และ Unselect All ได้ แบบนี้ 1. เลือก Edit Header Template เพื่อไปสร้าง Event ให้กับ CheckBox ที่ Header ของ GridView …
Read more

Categories ASP.net+VB Tags , , , , comment2 Comments

[ASP.net+VB] สร้าง CheckBox ใน GridView

วันนี้จะมาทำ CheckBox ให้อยู่ใน GridView แบบนี้ 1. เตรียม Database ให้พร้อม (ในที่นี้ใช้ Nwind.mdb) 2. เลือก control ที่ชื่อ GridView 3. จะได้แบบนี้ 4. เลือก New data source 5. เลือก ประเภทของฐานข้อมูล ในที่นี้ใช้ Access 6. เลือกไฟล์ฐานข้อมูลที่ต้องการผูกติดกับ GridView 7. จากนั้นกด Next 8. เลือก Column, Table ที่ต้องการ 9. …
Read more

Categories ASP.net+VB Tags , , , comment8 Comments

[ASP.net+VB] การสร้าง Pop-up Calendar

วันนี้จะทำ Pop Up Calendar แบบนี้ เมื่อคลิกที่ปุ่ม ก็จะโชว์ปฏิทิน แบบนี้ เตรียมพร้อมก่อนใช้งาน 1. ก่อนอื่น ต้องดาวโหลด Control Set จากเว็บนี้  eworldui.net เมื่อดาวโหลดมาเสร็จแล้วก็ install โลดดดดดดด 2. เมื่อ install เสร็จแล้วก็เปิด Visual Studio ขึ้นมา มองไปที่ toolbox แล้ว คลิกขวา เลือก Add Tab เพื่อสร้าง Tab สำหรับเก็บ Control ของ eWorldUI (จะไม่ …
Read more

Categories ASP.net+VB Tags , , , comment6 Comments

[ASP.net+VB] VBCrlf

vbcrlf ย่อมากจาก “Carriage return, Line feed” (vb = visual basic) หมายความว่า แถวว่างเปล่าที่ต่อท้ายทุกๆ string พูดง่ายๆ ก็คือ เป็นตัวเก็บว่า string นั้นได้ขึ้นบรรทัดใหม่แล้ว เป็น Function การตัด string ตัวอย่างเช่น มี textbox ที่เป็น multiline (หรือ textarea ใน html) ก็เป็นช่องสำหรับใส่ Description (txtDescription) และก็มีส่วนที่แสดง Description ที่เป็น label ธรรมดา (lblDescription) …
Read more

Categories ASP.net+VB Tags , , , , comment1 Comment