html中:
<asp:Repeater ID="Repeater1" runat="server" OnItemCommand="Repeater1_ItemCommand">
<ItemTemplate>
<tr>
<td>
<%#Eval("M_Addate", "{0:yyyy-MM-dd}")%>
</td>
<td>
<p style="width: 180px;">
<%#Eval("M_Title")%></p>
</td>
<td>
<asp:RadioButtonList ID="RadioButtonList1" runat="server" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged"
AutoPostBack="true">
</asp:RadioButtonList>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
CS中:
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
{
//RadioButtonList zj1 = (RadioButtonList)e.Item.FindControl("RadioButtonList1 ");
//HiddenField Mbit = (HiddenField)e.Item.FindControl("M_Bit");
//if (Mbit.Value.ToString() == "True")
//{
// zj1.Items[0].Selected = true;
//}
if (e.Item.ItemType == ListItemType.Item)
{
RadioButtonList rbl1 = (RadioButtonList)e.Item.FindControl("RadioButtonList1 ");
rbl1.DataSource = this.Repeater1.DataSource;
rbl1.DataTextField = "M_Bit";
rbl1.DataValueField = "M_ID";
rbl1.DataBind();
//if (Repeater1.Items[e.Item.ItemIndex].DataItem == "True ")
// rbl1.Items[0].Selected = true;
}
问题是在html中根本没有绑定出来。
repeater控件中html:redio的value值的绑定实现
页面代码如下:<asp:RadioButtonList ID="RBLProductColor" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow"> <\/asp:RadioButtonList> 后台代码如下:RBLProductColor.DataSource = productcolors;RBLProductColor.DataBind();for (int i = 0; i < productcolors.Count; i++){ \/\/System....
asp.net repeater 放入 DropDownList 选择项改变时 更新当前行数据的值...
DropWounList在选择改变的时候要绑定事件,这个没问题吧,在代码中绑定就ok了,绑定的事件逻辑上应该处理这些东西:找到激活这个事件的控件 自己 RadioButtonList rbl = sender as RadioButtonList; \/\/找到控件本身 获取他的上级控件 Repeater repS = rbl.Parent.Parent as Repeater; \/\/drop的上一级的上...
.net中的repeater中的<%#Eval("id")%>如何作为js的参数传入js中???
这样应该是可以的才对,测试下你的脚本是否有bug, radioButtonList 生成的是选择按钮来的, 还可以直接把id放在它的自定义属性里边 然后在这个change事件里边去读取这个自定义属性