【问题标题】:Asp Radiobutton errorAsp 单选按钮错误
【发布时间】:2018-05-11 13:50:10
【问题描述】:

我希望 Id 对应于数据项中的数据,以便我知道用户单击了哪个单选按钮:我写:

<asp:RadioButton ID="<%# DataBinder.Eval(Container.DataItem, "IdFlight") %> " runat="server" GroupName="Flights" />

但是我得到解析器的错误:标签的格式不正确。 请问有什么提示吗?

【问题讨论】:

  • 如果您在控制属性中使用Eval,请使用单引号:&lt;asp:RadioButton ID='&lt;%# DataBinder.Eval(Container.DataItem, "IdFlight") %&gt;' runat="server" GroupName="Flights" /&gt;
  • 我厌倦了,但我得到了同样的错误

标签: c# asp.net databinder


【解决方案1】:

您可以使用 HTML Input Radio 代替 ASP.net Radio。 并编写你想要的 jquery 函数。

<input type="radio" id="<%# DataBinder.Eval(Container.DataItem, "blog_id") %> "/>

【讨论】:

  • 如果 OP 想要在后面的代码中检查你的检查状态怎么办?
  • 但您根本不需要这样做..只需简单地使用具有普通 ID="chkStatus" 的 asp.net 单选按钮并在后面编写代码。 RadioButton chkdel = (RadioButton)item.FindControl("chkStatus") 在中继器项目中。
猜你喜欢
  • 1970-01-01
  • 2020-03-18
  • 2014-03-26
  • 2013-09-04
  • 1970-01-01
  • 2012-09-17
  • 1970-01-01
  • 2012-04-18
  • 2010-11-20
相关资源
最近更新 更多