当前位置: 代码迷 >> ASP.NET >> 在DropDownList中添加两个值,并用逗号分开。该如何解决
  详细解决方案

在DropDownList中添加两个值,并用逗号分开。该如何解决

热度:4201   发布时间:2013-02-26 00:00:00.0
在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 ";
  相关解决方案