2014-12-23 45 views
0

我正在将Foundation 5 Reveal Modal组件与<asp:LinkButton>集成。要使揭示模式起作用,需要在<asp:LinkButton>中添加一个非标准的HTML属性data-reveal-id。如果我不在下面的.aspx中添加此属性,那么单击LinkBut​​ton将触发rptNotice_ItemCommand。但是,如果将data-reveal-id添加到LinkBut​​ton中,如下所示rptNotice_ItemCommand不会运行,并且lbMessage未更新。数据库在提交模态表单时需要lbMessage将Repeater中的非标准属性添加到asp:LinkBut​​ton可防止运行OnItemCommand

我如何得到这个工作?

是否有另一种方式来跟踪消息ID?

.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> 

.aspx.cs文件

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

链接按钮的属性属性是一个集合...我认为你需要将你的数据属性添加到代码背后的属性集合中。像myLinkBut​​ton.Attributes.add(myCustomAttribute) – BillRuhl

+0

我试过,以及一旦我调用'Attributes.add()''rptNotice_ItemCommand()'不会触发。 –

回答

0

似乎可以解析的问题,由于未知参数。我会建议使用CommandArgument字段。尝试“replyModal”CommandArgument。

拆分后端的值并获取操作类型。

+0

基金会5揭示模态需求'data-reveal-id =“replyModal”'被设置,否则模态将不会出现。将它添加为'CommandArgument'可以防止揭示模态Javascript检测到点击。 –

+0

怎么样设置基础5模态可以使用的类名。这有可能吗? – theusguy

+0

我的理解是,这将需要重新编写揭示模式的基础JavaScript。我相信他们为什么不使用class属性有一个很好的理由。 –

相关问题