【问题标题】:Dynamically assigning a value to commandArg of a button in repeater control在中继器控件中为按钮的 commandArg 动态分配值
【发布时间】:2014-11-03 12:59:24
【问题描述】:

我试图在 Repeater 控件中执行此操作,在该控件中我将 ID 值分配给 CommandArgs。

<asp:ImageButton runat="server" CommandArgument="<%# DataBinder.Eval(Container.DataItem, "Id") %>"  style="margin-left:12px"  ID="uplink"   Height="75px" Width="75px" Text="Up" ImageAlign="Middle" ImageUrl="~/images/uparrow.png" ></asp:ImageButton>

但是,这种格式: CommandArgument="&lt;%# DataBinder.Eval(Container.DataItem, "Id") %&gt;"

告诉我标签格式不正确。我逃脱了 id 周围的引号,但这没有帮助。如何将 int id 分配给 CommandArgs 到中继器控件中的图像按钮?正确的格式是什么?

提前致谢。

【问题讨论】:

    标签: asp.net data-binding repeater


    【解决方案1】:

    Found this 有效。

    CommandArgument=''/>

    【讨论】:

      猜你喜欢
      • 2011-05-24
      • 2011-02-28
      • 1970-01-01
      • 1970-01-01
      • 2011-08-21
      • 1970-01-01
      • 2010-11-10
      • 2011-12-17
      • 1970-01-01
      相关资源
      最近更新 更多