DataTextField
データベースから複数のアイテム(姓と名)を付けたいです。これどうやってするの?
もちろん、DataTextField="surname + name"
うまくいきませんが、この2つのアイテムを一緒にする可能性はありますか?
私のコードがあります:
<asp:DropDownList runat="server" ID="dllSpecialist" DataValueField="iduserspecialist" DataTextField="surname" AutoPostBack="true" OnSelectedIndexChanged="dllSpecialist_IndexChanged" AppendDataBoundItems="true">
<asp:ListItem Text="" Value="0"></asp:ListItem>
</asp:DropDownList>
コードビハインド:
if (!IsPostBack)
{
dllSpecialist.DataSource = tUserSpecialistBO.getAllSpecialist();
dllSpecialist.DataBind();
(..)
}
SQL メソッド:
public static DataSet getAllSpecialist()
{
sql = "select * from tuserspecialist where del='false' and name!=''";
return SQLTools.getDataSet(sql);
}