RadioButtonList绑定后台的数据。

it2026-09-28  7

在前台,放置一个

   <td style="width: 650px;"><asp:RadioButtonList ID="RadioButtonList2" runat="server" RepeatDirection="Horizontal"></asp:RadioButtonList></td>

在后台绑定上展示的内容。

DataTable dtInvoiceType = OrderData.GetInvoiceType(); RadioButtonList2.DataSource = dtInvoiceType; RadioButtonList2.DataTextField = "Invoice_Name"; RadioButtonList2.DataValueField = "Invoice_ID"; RadioButtonList2.DataBind();

下面的FindByValue的方法是在加载的时候,页面上直接显示出来对应的值。

RadioButtonList2.Items.FindByValue(dtInfo.Rows[0]["Invoice_title"].ToString()).Selected = true;

转载于:https://www.cnblogs.com/ZkbFighting/p/10266552.html

相关资源:数据结构—成绩单生成器
最新回复(0)