- Windows Server 2008 显示桌面图标
- 什么是单工通信、半双工通信和全双工通信
- URLRewriter实现方法
- C# 核心概念--装箱和拆箱 .
- 企业信息化建设:ERP与CRM谁先行?
- 在.net的绑定事件中使用if控制语句
- 多语言网站制作怎么做?翻译、布局与SEO要点解析
- cook 的设置
- 触摸屏网站开发系列(一)-ios web App应用程序(ios meta)
- 建立CRM数据库的几个原则
邮箱:
手机:15383239821
RadioButtonList绑定后的默认选项
投票程序,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; //选中第一项
- 上一篇:将两个表数据绑定到一个GRIDVIEW中
- 下一篇:逻辑与运算符 &&
-
2024-03-01小程序隐私指引完整填写范本
-
2023-04-22单用户商城和多用户商城是什么
-
2012-10-24javascript关闭窗口
-
2013-04-27.Net中Math.Round与四舍五入
-
2012-11-30css position: absolute、relative详解
-
2023-09-17使用ThinkPHP6实现阿里云OSS文件上传和下载操作?
