|
 |
|
สอบถามเรื่องการแสดงค่า value ใน Dropdownlist ครับ [ ASP.NET C# webapp ] |
|
 |
|
|
 |
 |
|
ผมได้วิธีแก้แล้วล่ะครับ...
ตรงส่วนที่
Code (ASP)
List<PersonViewEntity> PersonList = this._personviewBiz.Select();
ตอนแรกใน VIew ของ MsSQL ที่ผมสร้างตอนแรกมีแค่ ID , NAME , SURNAME
SQL ประมาณว่า
SELECT ID,NAME,SURNAME
FROM PERSON
ผมสร้างอีก 1 คอลั่ม เป็น ชื่อ+นามสกุล เพิ่ม
SQL ประมาณว่า
SELECT ID,NAME,SURNAME,NAME+' '+SURNAME as "FULLNAME"
FROM PERSON
จากนั้นก็ดึงใส่ list ปกติ
Code (ASP)
List<PersonViewEntity> PersonList = this._personviewBiz.Select();
//*** DropDownList ***//
this.ddlPerson.DataSource = PersonList ;
this.ddlPerson.DataTextField = "FULLNAME";
this.ddlPerson.DataValueField = "ID";
this.ddlPerson.DataBind();
ก็ได้ละครับ
ปล.ใครมีวิธีอื่นเพิ่มเติมก็แนะนำได้นะครับ เผื่อจะง่ายกว่าที่ผมคิด 
|
ประวัติการแก้ไข 2012-07-31 14:17:01
 |
 |
 |
 |
Date :
2012-07-31 14:16:34 |
By :
oxlPonglxo |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ทำที่ sql น่ะ ถูกต้องที่สุดแล้ว
|
 |
 |
 |
 |
Date :
2012-08-01 08:51:42 |
By :
อิอิ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|