在DropDownList中添加两个值,并用逗号分开。
如题
SqlConnection con = DB.createCon();
con.Open();
SqlCommand cmd = new SqlCommand( "select * from setsystem where Sort=2 order by place ",con);
SqlDataReader sdr = cmd.ExecuteReader();
this.tdly.Attributes.Add( "onChange ", "ProcessBsc(options[selectedIndex].value) ");
this.tdly.DataSource=sdr;
this.tdly.DataTextField= "setname ";
this.tdly.DataValueField= "ID ";
this.tdly.DataBind();
sdr.Close();
就是在this.tdly.DataValueField= "ID ";中添加两个列名并用逗号分开
[解决办法]
select cast(id as varchar(10))+ ', '+ 列2 as 列2 ,* from ...this.tdly.DataValueField= "列2 ";