0

我经常使用 MultiViews,而且我看到了一个我从未遇到过的奇怪问题。只有在第一个 Multiview 索引上或其外部的控件才会触发其附加的事件处理程序。MultiView 位于 UserControl 内。

我可以更改 MultiView 索引,但任何索引中的任何控件都不是0都不会触发事件处理程序。是否有任何合理的原因或我可以调试它的方式?

我的 MultiView 被声明为

    <asp:Button ID="btnPostTopicAlsoWorking" runat="server" Text="Post Topic" CssClass="button" ValidationGroup="post" OnClick="btnPostTopic_Click"/>
<asp:MultiView runat="server" ID="mltMain" ActiveViewIndex="0" OnActiveViewChanged="viw_Changed">
    <asp:View runat="server" ID="viwCategories">
        ...this works
        <asp:Button ID="btnPostTopic" runat="server" Text="Post Topic" CssClass="button" ValidationGroup="post" OnClick="btnPostTopic_Click"/>
    </asp:View>
    <asp:View runat="server" ID="viwCategorySingle">
        ...this does not work
        <asp:Button ID="btnPostTopicBroken" runat="server" Text="Post Topic" CssClass="button" ValidationGroup="post" OnClick="btnPostTopic_Click"/>
4

1 回答 1

0

This was a nightmare to track down. The UC is embedded in an Umbraco page, and the UC is added with a macro. If I create a MasterPage and include the macro like this:

<%@ Master Language="C#" MasterPageFile="~/masterpages/umbMaster.master" AutoEventWireup="true" %>

<asp:Content ID="Content2" ContentPlaceHolderID="cp_content" runat="server">
    <umbraco:Item ID="Item1"  runat="server" field="bodyText" />
</asp:Content>

I can create an Umbraco page, insert the macro with the editor and it'll display and be half functional. To get it to work 'as expected', I needed to embed the macro directly in the MasterPage:

<asp:Content ID="Content2" ContentPlaceHolderID="cp_content" runat="server">
    <umbraco:Macro ID="Macro1" runat="server" Alias="forumCategoryFrontEnd"/>
</asp:Content>
于 2013-08-02T10:40:45.450 回答