C# 外部Button事件里能获得Repeater里的HiddenField 控件值吗? 10
不含在Repeater里的Button,并在这Button事情里想获得Repeater里的HiddenField控件值,具体怎么呢?高手们谢谢了~~!我只是想把获得最后结...
不含在Repeater里的Button,并在这Button事情里想获得Repeater里的HiddenField 控件值,具体怎么呢?高手们谢谢了~~!
我只是想把获得最后结果某字段的集合~~! 展开
我只是想把获得最后结果某字段的集合~~! 展开
1个回答
展开全部
<asp:CheckBox ID="chkChoose" runat="server" /><asp:HiddenField ID="hfCategory" runat="server"
Value='<%# Eval("Id") %>' />
<%# Eval("Name") %>
public List<Guid> Selected
{
get
{
List<Guid> l = new List<Guid>();
foreach (RepeaterItem item in rptCategory.Items)
{
CheckBox cb = item.FindControl("chkChoose") as CheckBox;
if (cb != null && cb.Checked)
{
HiddenField fld = item.FindControl("hfCategory") as HiddenField;
if (fld != null)
{
Guid id = new Guid(fld.Value);
l.Add(id);
}
}
}
return l;
}
}
Value='<%# Eval("Id") %>' />
<%# Eval("Name") %>
public List<Guid> Selected
{
get
{
List<Guid> l = new List<Guid>();
foreach (RepeaterItem item in rptCategory.Items)
{
CheckBox cb = item.FindControl("chkChoose") as CheckBox;
if (cb != null && cb.Checked)
{
HiddenField fld = item.FindControl("hfCategory") as HiddenField;
if (fld != null)
{
Guid id = new Guid(fld.Value);
l.Add(id);
}
}
}
return l;
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询