标题:错在那里,请高手给看看
取消只看楼主
shevchenkoka
Rank: 1
等 级:新手上路
帖 子:34
专家分:0
注 册:2005-3-27
 问题点数:0 回复次数:0 
错在那里,请高手给看看

今天讲的内容,本人觉得代码写的没有错,但是不知道为什么那个RadioButtonList在远行后就是显示不出来!请高手给看看! 源代码如下: using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Data.SqlClient; namespace votetxxy { /// <summary> /// WebForm1 的摘要说明。 /// </summary> public class WebForm1 : System.Web.UI.Page { protected System.Web.UI.WebControls.Label Label1; protected System.Web.UI.WebControls.Button Button1; protected System.Web.UI.WebControls.Button Button2; protected System.Web.UI.WebControls.RadioButtonList RadioButtonList1; int votetype=2; private void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 if(!this.IsPostBack) { SqlConnection cnn=new SqlConnection("server=.;database=wklhdt;uid=sa;pwd=189934;"); cnn.Open(); SqlCommand cmm=new SqlCommand("Select votetitle from votetitle where id="+this.votetype.ToString(),cnn); string votetitle=cmm.ExecuteScalar().ToString(); this.Label1.Text=votetitle; SqlCommand cmm1=new SqlCommand("select voteitemid,voteitem from voteitem where voteid="+this.votetype.ToString() ,cnn); SqlDataReader sdr=cmm1.ExecuteReader(); this.RadioButtonList1.DataSource=sdr; this.RadioButtonList1.DataTextField="voteitem"; this.RadioButtonList1.DataValueField="voteitemid"; this.RadioButtonList1.DataBind(); this.RadioButtonList1.SelectedIndex=1; sdr.Close(); cnn.Close(); } }

#region Web 窗体设计器生成的代码 override protected void OnInit(EventArgs e) { // // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。 // InitializeComponent(); base.OnInit(e); } /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load);

} #endregion } }

搜索更多相关主题的帖子: 源代码 using 
2005-09-28 20:36



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-28950-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.709467 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved