读书人

在DropDownList中添加两个值并用逗号

发布时间: 2012-01-06 22:55:18 作者: rapoo

在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 ";

读书人网 >asp.net

热点推荐