简体   繁体   English

将非标准属性添加到R​​epeater中的asp:LinkBut​​ton会阻止OnItemCommand的运行

[英]Adding Non-Standard Attribute to asp:LinkButton inside Repeater prevents the run of OnItemCommand

I am integrating a Foundation 5 Reveal Modal component with an <asp:LinkButton> . 我正在将Foundation 5 Reveal Modal组件与<asp:LinkButton>集成在一起。 For the reveal modal to work it requires the addition of a non-standard HTML attribute data-reveal-id to the <asp:LinkButton> . 为了使显示模式起作用,它需要在<asp:LinkButton>添加一个非标准的HTML属性data-reveal-id If I do 'not' add this attribute in the .aspx below, then clicking the LinkButton will trigger rptNotice_ItemCommand . 如果我不“在”下面的.aspx中添加此属性,则单击LinkBut​​ton将触发rptNotice_ItemCommand However, when data-reveal-id is added to the LinkButton as shown below rptNotice_ItemCommand does not run, and lbMessage is not updated. 但是,将data-reveal-id如下所示添加到LinkBut​​ton时, rptNotice_ItemCommand无法运行,并且lbMessage也不会更新。 The lbMessage is required by the database upon submission of the modal form. 提交模态表单后,数据库需要lbMessage

How do I get this to work? 我该如何工作?

Is there another way to keep track of the message ID? 还有另一种跟踪消息ID的方法吗?

In the .aspx file .aspx文件中

<!-- Foundation 5 Reveal Modal -->
<div id="replyModal" class="reveal-modal" data-reveal>
    <h2>Reply to Notice</h2>
    <asp:Label ID="lbMessage" runat="server" />
    <asp:TextBox ID='tbFollowQuestion' runat="server" TextMode="MultiLine" Width="100%" /><br />               
    <asp:Button ID="btnFollowCancel" runat="server" Text="Cancel" OnClick="followQuestionCancel_Clicked" />
    <asp:Button ID="btnFollowQuestion" runat="server" Text="Submit" OnClick="followQuestionSave_Clicked" />

    <a class="close-reveal-modal">&#215;</a>
</div>

<asp:Repeater ID="rptNotice" runat="server" OnItemCommand="rptNotice_ItemCommand">
    <ItemTemplate>
        <div class="row padding-bottom-10 border-bottom-1 margin-bottom-10">                
            <!-- LinkButton -->
            <div class="small-6 medium-2 xlarge-1 columns">
                    <asp:LinkButton data-reveal-id="replyModal" CommandName="Contact" CommandArgument='<%#Eval("MessageId")%>' ToolTip="Reply" runat="server"><img src="/images/icon/envelop.jpg" alt="Contact Us"><strong class="font-size-14">Reply</strong></asp:LinkButton>
            </div>
        </div>
    </ItemTemplate>
</asp:Repeater>

In the .aspx.cs file .aspx.cs文件中

public void rptNotice_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
{
    lbMessage.Text = "MessageId: " + e.CommandArgument.ToObjectString();
}

There seems to be possible parsing issue due to unknown parameter. 由于参数未知,似乎存在解析问题。 I would suggest using CommandArgument field. 我建议使用CommandArgument字段。 Try "replyModal" to CommandArgument . 尝试对CommandArgument进行“ replyModal”。

Split the value at backend and get operation type. 在后端拆分值并获取操作类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 asp:Repeater的OnItemCommand不使用验证器 - OnItemCommand of asp:Repeater not working with validator 在Repeater内部的Linkbutton用于分页ASP.Net - Linkbutton inside Repeater for paging ASP.Net OnItemCommand函数不能与Listview中的ASP Linkbutton一起使用 - OnItemCommand function not working with asp Linkbutton in Listview 如何使用转发器的OnItemCommand触发文本框的事件,而不使用LinkBut​​ton? - How to fire event of textbox with OnItemCommand of a repeater , without using LinkButton? 如何查找。通过Watin使用非标准属性? - How to Find.By a non-standard attribute with Watin? 将onmouseover属性添加到 <asp:Panel> 在一个 <asp:Repeater> - Adding an onmouseover attribute to an <asp:Panel> in a <asp:Repeater> 解析非标准JSON - Parsing non-standard JSON 如何在Repeater Asp.Net C#中的LinkBut​​ton中更改图像源 - How to change image source inside LinkButton in Repeater Asp.Net C# 绑定输入密钥到asp net linkbutton repeater - binding enter key to asp net linkbutton repeater 为什么Repeater控件内部的LinkBut​​ton加载整个页面? 如何在ASP.NET中处理此问题 - Why LinkButton inside repeater control load whole page? How to handle this issue in asp.net
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM