求一个RadioButtonList数据邦定的例子

mis8cn 2007-05-23 11:31:17
哪位大哥给个例子学习下,新手谢谢了。
...全文
198 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
criedshy 2008-11-18
  • 打赏
  • 举报
回复
买,07年的贴子啊
criedshy 2008-11-18
  • 打赏
  • 举报
回复
   
con.Open();

SqlDataAdapter sd = new SqlDataAdapter ( "select * from fie_VoteList ", con);
DataSet ds=new DataSet();
sd.Fill(ds);
this.RadioButtonListVoteList.DataSource = ds.Tables[0];
this.RadioButtonListVoteList.DataValueField = "VLid ";
this.RadioButtonListVoteList.DataTextField = "VoteList ";
this.RadioButtonListVoteList.DataBind();

con.Close();
criedshy 2008-11-18
  • 打赏
  • 举报
回复
   
con.Open();

SqlDataAdapter sd = new SqlDataAdapter ( "select * from fie_VoteList ", con);
DataSet ds=new DataSet();
sd.Fill(ds);
this.RadioButtonListVoteList.DataSource = ds.Tables[0];
this.RadioButtonListVoteList.DataValueField = "VLid ";
this.RadioButtonListVoteList.DataTextField = "VoteList ";
this.RadioButtonListVoteList.DataBind();

con.Close();
gengwanshanreally 2008-11-18
  • 打赏
  • 举报
回复
2楼的可以吧
mis8cn 2007-05-23
  • 打赏
  • 举报
回复
谢谢,虽然还是有些地方不明白
lshclshc 2007-05-23
  • 打赏
  • 举报
回复
public void ChooseNewsClass()
{
OleDbConnection con=DB.CreateCon ();
OleDbCommand cmd=new OleDbCommand ("select classname from newsclass",con);
con.Open();
OleDbDataReader dr=cmd.ExecuteReader();
this.RadioButtonList1.DataSource=dr;
this.RadioButtonList1.DataTextField="classname";
this.RadioButtonList1.DataBind();
dr.Close();
con.Close();
}



你看看吧
dandysunny 2007-05-23
  • 打赏
  • 举报
回复
.aspx
-----------------------------
<asp:RadioButtonList ID="CheckBoxList1" runat="server" RepeatColumns="2" RepeatLayout="Table" AutoPostBack="true">
</asp:RadioButtonList>
---------------------------------
.aspx.vb
----------------------------------
Dim cmdstr1 As String = "select custid,corpname from ComCustomer where corpname Like '%" + txtBoxKey.Text.ToString() + "%'"
Dim conn As New SqlConnection(Connect.connstr)

Dim da As New SqlDataAdapter(cmdstr1, conn)
Dim ds As New DataSet()
conn.Open()
da.Fill(ds)

CheckBoxList1.DataSource = ds
CheckBoxList1.DataTextField = "corpname"
CheckBoxList1.DataValueField = "custid"
CheckBoxList1.DataBind()
mis8cn 2007-05-23
  • 打赏
  • 举报
回复
con.Open();
SqlCommand cmd1 = new SqlCommand("select * from fie_VoteList", con);
SqlDataReader sad = cmd1.ExecuteReader();
this.RadioButtonListVoteList.DataSource = sad;
this.RadioButtonListVoteList.DataValueField = "VLid";
this.RadioButtonListVoteList.DataTextField = "VoteList";
this.RadioButtonListVoteList.DataBind();
sad.Close();
con.Close();

这样子不行啊

62,266

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧