国产经典久久久,欧美图片在线视频,亚洲天堂精品在线,中文字幕第69页,中日韩免费毛片,欧美18直播app,国产精品国产精品

主營業(yè)務:網站制作 網站優(yōu)化 小程序制作 石家莊網站制作網站建設有限公司歡迎您!
石家莊閃云網絡科技有限公司
客服熱線15383239821
如何讓自己的網站更有質量?

RadioButtonList綁定后的默認選項

發(fā)布時間:2010/9/15 15:07:50

投票程序,RadioButtonList綁定后,剛打開的頁面RadioButtonList是沒有選中的,怎么使頁面一打開默認第一項被選中。  
   
  private   void   Page_Load(object   sender,   System.EventArgs   e)  
  {  
  if(!this.IsPostBack)  
  {  
  SqlConnection   con=DB.createCon();  
  con.Open();  
  SqlCommand   cmd=new   SqlCommand("select   vTitle   from   vote   where   vID="+this.vID+"",con);  
  this.Label1.Text=Convert.ToString(cmd.ExecuteScalar());  
  //   在此處放置用戶代碼以初始化頁面  
  SqlConnection   con1=DB.createCon();  
  con1.Open();  
  SqlCommand   cmd1=new   SqlCommand("select   vItemID,vItem   from   voteItem   where   vID="+this.vID+"",con1);  
  SqlDataReader   sdr=cmd1.ExecuteReader();  
  this.RadioButtonList1.DataSource=sdr;  
  this.RadioButtonList1.DataTextField="vItem";  
  this.RadioButtonList1.DataValueField="vItemID";  
  this.RadioButtonList1.DataBind();  
  sdr.Close();  
  con1.Close();  
  }  
  }

回答: 加上this.RadioButtonList1.SelectedIndex   =   0;   //選中第一項

相關新聞推薦

在線客服 : 服務熱線:15383239821 電子郵箱: 27535611@qq.com

公司地址:石家莊市新華區(qū)九中街江西大廈4062

備案號:冀ICP備2022000585號-4