then you should change your sql toselect typeid + ' ' + typenme as tid from yourtablem_DropDownList.DataSource = ds.Tables["ProductType"].DefaultView;
m_DropDownList.DataTextField = "Tid";
m_DropDownList.DataBind();or just doforech(DataRow dr in ds.Tables["ProductType"].Rows)
{
m_DropDownList.Items.Add(dr["TypeID"].ToString() + " " + dr["TypeName"].ToString());
}
m_DropDownList.DataTextField = "Tid";
m_DropDownList.DataBind();or just doforech(DataRow dr in ds.Tables["ProductType"].Rows)
{
m_DropDownList.Items.Add(dr["TypeID"].ToString() + " " + dr["TypeName"].ToString());
}
Select typeid,typename,'' + typeid + typename as type from Table1 (注:sql server)
那么
m_DropDownList.DataTextField = "Type";当然选项的文字是可以改的,但并不是太好
foreach(ListItem tmpItem in m_DropDownList.Items)
{
tmpItem.Text += tmpItem.Value;
}