1

我已经在谷歌上搜索了大约一天,我发现的每一篇文章都太旧了,Visual Studio 无法识别人们发布的一些代码。我有一个动态填充的列表视图。出于可读性的目的,我真的希望其他每一行都被遮蔽,只是想不通。

我尝试做的所有事情都与我在 Listview 中的 Modal PopupExtender 混淆。它也试图遮蔽 PopUpBox 内的线条。这是我想要遮蔽的列表视图之一。

<!-- Descriptions -->
<asp:TabPanel ID="tab2"  runat="server" HeaderText="Descriptions">
<HeaderTemplate>Descriptions</HeaderTemplate>
    <ContentTemplate>
        <ul class="info">
        <asp:ListView ID="lvDescriptions" runat="server" DataSourceID="dsMarketingDescriptions" DataKeyNames="MarketingID">
        <ItemTemplate>
            <li>
                <asp:LinkButton ID="ViewDescriptionButton" runat="server"><%#Eval("MarketingTitle")%></asp:LinkButton>
                <asp:Panel ID="ViewDescriptionPanel" runat="server" CssClass="DescModalPopup">                   <div class="PopupHeader" id="PopupHeader">View Description
                <asp:ImageButton ID="CancelDescriptionButton" runat="server" ImageUrl="../../images/exit.png" AlternateText="" Style="float:right;"/>
                </div>
                    <asp:Label ID="Description" runat="server" style="padding:5px;"><%# Eval("MarketingData") %></asp:Label>
                </asp:Panel> 
                <asp:ModalPopupExtender ID="ViewDescriptionModal" runat="server" BackgroundCssClass="modalBackground" DropShadow="false" DynamicServicePath="" Enabled="true" PopupControlID="ViewDescriptionPanel" TargetControlID="ViewDescriptionButton" CancelControlID="CancelDescriptionButton"></asp:ModalPopupExtender>              
            </li>
        </ItemTemplate>
        </asp:ListView>
        </ul>
    </ContentTemplate>
</asp:TabPanel>

在此处输入图像描述

4

1 回答 1

1

尝试使用AlternatingItemTemplate为交替项目指定不同的背景颜色。

你想用 ModalPopupExtender 做这样的事情吗?:

protected void ListView1_ItemDataBound(object sender, ListViewItemEventArgs e)
{
    Panel pnl = e.Item.FindControl("Panel1") as Panel;
    if (pnl != null)
    {
        pnl.BackColor = ListView1.Items.IndexOf(e.Item) % 2 == 1 ? Color.PeachPuff : Color.White;
    }
}
于 2011-09-14T18:42:38.753 回答