在当前上下文中找不到数据列表

发布于 2024-10-20 17:59:17 字数 16347 浏览 7 评论 0原文

我正在开发一个网页并使用数据列表控件。

  <%@ Page Language="C#" MasterPageFile="~/Master.master" AutoEventWireup="true" CodeFile="Concerts.aspx.cs"
    Inherits="Default2"  %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct="UA-15707367-1";
urchinTracker();

</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    <%= strModuleName%>
    <asp:UpdatePanel ID="upUpdateConcert" runat="server">
        <ContentTemplate>
            <div class="LeftContaionerTopTextStyle">
              <asp:LinkButton ID="lnkConcert" CssClass="LeftContainerHeaderText" runat="server" OnClick="lnkConcert_Click">Concerts & Tickets</asp:LinkButton><br />
                <asp:LinkButton ID="lnkTickets" CssClass="Link" runat="server" OnClick="lnkConcert_Click">Ticket Policies </asp:LinkButton><br />
                 <asp:LinkButton ID="lnkSeating" CssClass="Link" runat="server" OnClick="lnkConcert_Click">Seating Chart</asp:LinkButton><br />
                <asp:LinkButton ID="lnkGroup" CssClass="Link" runat="server" OnClick="lnkConcert_Click">Group Sales </asp:LinkButton><br />
                <asp:LinkButton ID="lnkDirection" CssClass="Link" runat="server" OnClick="lnkConcert_Click">Directions & Parking</asp:LinkButton><br />


            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <%-- DATALIST FOR CONCERT TITLE AND IMAGE --%> 
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="RightContainerHeaderText">
        <%#Eval("ConcertTitle") %>
        </div>
          <div class="RightContainerText">
            <div class="HomeLeftPanel">
                <%-- DATALIST FOR CONCERT DATE IMAGE --%>
                <asp:DataList ID="dlConcerts" runat="server" OnItemDataBound="dlConcerts_ItemDataBound"
                    RepeatColumns="1" OnItemCommand="dlConcerts_ItemCommand" RepeatDirection="Vertical" 
                    >
                    <ItemTemplate>
<div id="divHr" runat="server" class="DivHRConcerts">


                        <div class="DivInnerHRConcerts">

                            2010-2012 Concert Season

                        </div>

                                    </div>

                        <div class="LeftConcertsContainer">
                            <div class="LeftConcertsImageContainer">
                                <img src='ConcertImages/<%#Eval("ConcertImage") %>' alt='<%#Eval("ConcertImage") %>'
                                    title='<%#Eval("ConcertImage") %>' />
                            </div>
                            <div class="LeftConcertsHeading">
                                <span class="HeadingGreen">
                                    <%#Eval("ConcertTitle") %></span><br />
                                <%-- DATALIST FOR CONCERT DATE IMAGE --%>
                                <asp:DataList ID="dlConcertDates" runat="server">
                                    <ItemTemplate>
                                        <span class="ConcertsTime">
                                            <%#Eval("ConcertDate") %></span>
                                    </ItemTemplate>
                                </asp:DataList>
                            </div>
                            <div class="ConcertsLeftTextArea">
                                <%-- DATALIST FOR CONCERT GUESTS IMAGE --%>
                                <asp:DataList ID="dlConcertGuests" runat="server" RepeatColumns="1" RepeatDirection="Vertical">
                                    <ItemTemplate>
                                        <table cellpadding="0" cellspacing="0" border="0" width="100%">
                                            <tr>
                                                <td>
                                                    <%#Eval("GuestName") %><span>, </span><%#Eval("InstrumentName") %>
                                                </td>
                                            </tr>
                                        </table>
                                    </ItemTemplate>
                                </asp:DataList>
                            </div>
                            <div class="ConcertsRightTextContainer">
                                <div class="ConcertsRightTextArea">
                                    <%-- DATALIST FOR CONCERT REPERTORIE IMAGE --%>
                                    <asp:DataList ID="dlRepetoire" runat="server" RepeatColumns="1" RepeatDirection="Vertical">
                                         <HeaderTemplate>
                                                        <table cellpadding="0" cellspacing="0" border="0" width="212px">
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <tr>
                                                            <td valign="top" style="width:90px">
                                                                <%#Eval("RepertoireName") %>
                                                                &nbsp;
                                                            </td>
<td style="width:10px">
&nbsp;
</td>
                                                            <td valign="top">
                                                                <%#Eval("RepertoireTitle")%>
                                                            </td>
                                                        </tr>
                                                    </ItemTemplate>
                                                    <FooterTemplate>
                                                        </table></FooterTemplate>
                                    </asp:DataList>
                                </div>



                                <div class="ConcertsButtonContainer" >
                                <div class="LearnMoreButton" ><a href="Content.aspx?ModuleID=63">
                                                        <img src="Images/SubscribeButton.jpg" border="0" /></a></div>
<div class="OrderTicketsButton" id="div1" runat="server"><asp:ImageButton ID="btnLearnMore" ImageUrl="Images/LearnMore.jpg" CommandArgument='<%#Eval("ConcertID") %>'
                                                    CommandName="LearnMore" Width="94" Height="19" runat="server" />
                                                    </div>
                                <div class="OrderTicketsButton" id="divSingleTicket" runat="server">
                                  <div id="sddm"  onmouseover="mopen('<%#Eval("ConcertID") %>')"
                                        onmouseout="mclosetime()">
                                        <img src="Images/OrderTickets.jpg" id="imgOrder" style="cursor: pointer;" runat="server"
                                            width="111" height="19" /><br />
                                        <div id='<%#Eval("ConcertID") %>' onmouseover="mcancelclosetime();" onmouseout="mclosetime()">
                                            <table id="tableProjectList" runat="server" cellpadding="0" cellspacing="0" border="0">
                                            </table>
                                        </div>
                                    </div>
                                </div>

                                </div>
                                <div class="SubscribeButton" id="divSubscribe" runat="server" >
                                <asp:ImageButton ID="btnLearnMore1" ImageUrl="Images/LearnMore.jpg" CommandArgument='<%#Eval("ConcertID") %>'
                                                    CommandName="LearnMore" Width="94" Height="19" runat="server" />
                                </div>

                            </div>
                        </div>
                        <div class="DotImage">
                        </div>
                    </ItemTemplate>
                </asp:DataList>

            </div>

                <asp:DataList ID="dlConcerts0" runat="server" OnItemDataBound="dlConcerts_ItemDataBound"
                    RepeatColumns="1" OnItemCommand="dlConcerts_ItemCommand" RepeatDirection="Vertical" 
                    >
                    <ItemTemplate>
<div id="divHr0" runat="server" class="DivHRConcerts">


                        <div class="DivInnerHRConcerts">

                            2011-2012 Concert Season

                        </div>

                                    </div>

                        <div class="LeftConcertsContainer">
                            <div class="LeftConcertsImageContainer">
                                <img src='ConcertImages/<%#Eval("ConcertImage") %>' alt='<%#Eval("ConcertImage") %>'
                                    title='<%#Eval("ConcertImage") %>' />
                            </div>
                            <div class="LeftConcertsHeading">
                                <span class="HeadingGreen">
                                    <%#Eval("ConcertTitle") %></span><br />
                                <%-- DATALIST FOR CONCERT DATE IMAGE --%>
                                <asp:DataList ID="dlConcertDates" runat="server">
                                    <ItemTemplate>
                                        <span class="ConcertsTime">
                                            <%#Eval("ConcertDate") %></span>
                                    </ItemTemplate>
                                </asp:DataList>
                            </div>
                            <div class="ConcertsLeftTextArea">
                                <%-- DATALIST FOR CONCERT GUESTS IMAGE --%>
                                <asp:DataList ID="dlConcertGuests" runat="server" RepeatColumns="1" RepeatDirection="Vertical">
                                    <ItemTemplate>
                                        <table cellpadding="0" cellspacing="0" border="0" width="100%">
                                            <tr>
                                                <td>
                                                    <%#Eval("GuestName") %><span>, </span><%#Eval("InstrumentName") %>
                                                </td>
                                            </tr>
                                        </table>
                                    </ItemTemplate>
                                </asp:DataList>
                            </div>
                            <div class="ConcertsRightTextContainer">
                                <div class="ConcertsRightTextArea">
                                    <%-- DATALIST FOR CONCERT REPERTORIE IMAGE --%>
                                    <asp:DataList ID="dlRepetoire" runat="server" RepeatColumns="1" RepeatDirection="Vertical">
                                         <HeaderTemplate>
                                                        <table cellpadding="0" cellspacing="0" border="0" width="212px">
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <tr>
                                                            <td valign="top" style="width:90px">
                                                                <%#Eval("RepertoireName") %>
                                                                &nbsp;
                                                            </td>
<td style="width:10px">
&nbsp;
</td>
                                                            <td valign="top">
                                                                <%#Eval("RepertoireTitle")%>
                                                            </td>
                                                        </tr>
                                                    </ItemTemplate>
                                                    <FooterTemplate>
                                                        </table></FooterTemplate>
                                    </asp:DataList>
                                </div>



                                <div class="ConcertsButtonContainer" >
                                <div class="LearnMoreButton" ><a href="Content.aspx?ModuleID=63">
                                                        <img src="Images/SubscribeButton.jpg" border="0" /></a></div>
<div class="OrderTicketsButton" id="div2" runat="server"><asp:ImageButton ID="btnLearnMore" ImageUrl="Images/LearnMore.jpg" CommandArgument='<%#Eval("ConcertID") %>'
                                                    CommandName="LearnMore" Width="94" Height="19" runat="server" />
                                                    </div>
                                <div class="OrderTicketsButton" id="divSingleTicket0" runat="server">
                                  <div id="sddm0"  onmouseover="mopen('<%#Eval("ConcertID") %>')"
                                        onmouseout="mclosetime()">
                                        <img src="Images/OrderTickets.jpg" id="imgOrder0" style="cursor: pointer;" runat="server"
                                            width="111" height="19" /><br />
                                        <div id='<%#Eval("ConcertID") %>0' onmouseover="mcancelclosetime();" 
                                            onmouseout="mclosetime()">
                                            <table id="tableProjectList0" runat="server" cellpadding="0" cellspacing="0" 
                                                border="0">
                                            </table>
                                        </div>
                                    </div>
                                </div>

                                </div>
                                <div class="SubscribeButton" id="divSubscribe0" runat="server" >
                                <asp:ImageButton ID="btnLearnMore1" ImageUrl="Images/LearnMore.jpg" CommandArgument='<%#Eval("ConcertID") %>'
                                                    CommandName="LearnMore" Width="94" Height="19" runat="server" />
                                </div>

                            </div>
                        </div>
                        <div class="DotImage">
                        </div>
                    </ItemTemplate>
                </asp:DataList>

        </div>

</asp:Content>

当我将它用于编码时,它给出错误 dlConcerts0 不存在

I am working on a webpage and using a datalist control.

  <%@ Page Language="C#" MasterPageFile="~/Master.master" AutoEventWireup="true" CodeFile="Concerts.aspx.cs"
    Inherits="Default2"  %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct="UA-15707367-1";
urchinTracker();

</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    <%= strModuleName%>
    <asp:UpdatePanel ID="upUpdateConcert" runat="server">
        <ContentTemplate>
            <div class="LeftContaionerTopTextStyle">
              <asp:LinkButton ID="lnkConcert" CssClass="LeftContainerHeaderText" runat="server" OnClick="lnkConcert_Click">Concerts & Tickets</asp:LinkButton><br />
                <asp:LinkButton ID="lnkTickets" CssClass="Link" runat="server" OnClick="lnkConcert_Click">Ticket Policies </asp:LinkButton><br />
                 <asp:LinkButton ID="lnkSeating" CssClass="Link" runat="server" OnClick="lnkConcert_Click">Seating Chart</asp:LinkButton><br />
                <asp:LinkButton ID="lnkGroup" CssClass="Link" runat="server" OnClick="lnkConcert_Click">Group Sales </asp:LinkButton><br />
                <asp:LinkButton ID="lnkDirection" CssClass="Link" runat="server" OnClick="lnkConcert_Click">Directions & Parking</asp:LinkButton><br />


            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <%-- DATALIST FOR CONCERT TITLE AND IMAGE --%> 
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="RightContainerHeaderText">
        <%#Eval("ConcertTitle") %>
        </div>
          <div class="RightContainerText">
            <div class="HomeLeftPanel">
                <%-- DATALIST FOR CONCERT DATE IMAGE --%>
                <asp:DataList ID="dlConcerts" runat="server" OnItemDataBound="dlConcerts_ItemDataBound"
                    RepeatColumns="1" OnItemCommand="dlConcerts_ItemCommand" RepeatDirection="Vertical" 
                    >
                    <ItemTemplate>
<div id="divHr" runat="server" class="DivHRConcerts">


                        <div class="DivInnerHRConcerts">

                            2010-2012 Concert Season

                        </div>

                                    </div>

                        <div class="LeftConcertsContainer">
                            <div class="LeftConcertsImageContainer">
                                <img src='ConcertImages/<%#Eval("ConcertImage") %>' alt='<%#Eval("ConcertImage") %>'
                                    title='<%#Eval("ConcertImage") %>' />
                            </div>
                            <div class="LeftConcertsHeading">
                                <span class="HeadingGreen">
                                    <%#Eval("ConcertTitle") %></span><br />
                                <%-- DATALIST FOR CONCERT DATE IMAGE --%>
                                <asp:DataList ID="dlConcertDates" runat="server">
                                    <ItemTemplate>
                                        <span class="ConcertsTime">
                                            <%#Eval("ConcertDate") %></span>
                                    </ItemTemplate>
                                </asp:DataList>
                            </div>
                            <div class="ConcertsLeftTextArea">
                                <%-- DATALIST FOR CONCERT GUESTS IMAGE --%>
                                <asp:DataList ID="dlConcertGuests" runat="server" RepeatColumns="1" RepeatDirection="Vertical">
                                    <ItemTemplate>
                                        <table cellpadding="0" cellspacing="0" border="0" width="100%">
                                            <tr>
                                                <td>
                                                    <%#Eval("GuestName") %><span>, </span><%#Eval("InstrumentName") %>
                                                </td>
                                            </tr>
                                        </table>
                                    </ItemTemplate>
                                </asp:DataList>
                            </div>
                            <div class="ConcertsRightTextContainer">
                                <div class="ConcertsRightTextArea">
                                    <%-- DATALIST FOR CONCERT REPERTORIE IMAGE --%>
                                    <asp:DataList ID="dlRepetoire" runat="server" RepeatColumns="1" RepeatDirection="Vertical">
                                         <HeaderTemplate>
                                                        <table cellpadding="0" cellspacing="0" border="0" width="212px">
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <tr>
                                                            <td valign="top" style="width:90px">
                                                                <%#Eval("RepertoireName") %>
                                                                 
                                                            </td>
<td style="width:10px">
 
</td>
                                                            <td valign="top">
                                                                <%#Eval("RepertoireTitle")%>
                                                            </td>
                                                        </tr>
                                                    </ItemTemplate>
                                                    <FooterTemplate>
                                                        </table></FooterTemplate>
                                    </asp:DataList>
                                </div>



                                <div class="ConcertsButtonContainer" >
                                <div class="LearnMoreButton" ><a href="Content.aspx?ModuleID=63">
                                                        <img src="Images/SubscribeButton.jpg" border="0" /></a></div>
<div class="OrderTicketsButton" id="div1" runat="server"><asp:ImageButton ID="btnLearnMore" ImageUrl="Images/LearnMore.jpg" CommandArgument='<%#Eval("ConcertID") %>'
                                                    CommandName="LearnMore" Width="94" Height="19" runat="server" />
                                                    </div>
                                <div class="OrderTicketsButton" id="divSingleTicket" runat="server">
                                  <div id="sddm"  onmouseover="mopen('<%#Eval("ConcertID") %>')"
                                        onmouseout="mclosetime()">
                                        <img src="Images/OrderTickets.jpg" id="imgOrder" style="cursor: pointer;" runat="server"
                                            width="111" height="19" /><br />
                                        <div id='<%#Eval("ConcertID") %>' onmouseover="mcancelclosetime();" onmouseout="mclosetime()">
                                            <table id="tableProjectList" runat="server" cellpadding="0" cellspacing="0" border="0">
                                            </table>
                                        </div>
                                    </div>
                                </div>

                                </div>
                                <div class="SubscribeButton" id="divSubscribe" runat="server" >
                                <asp:ImageButton ID="btnLearnMore1" ImageUrl="Images/LearnMore.jpg" CommandArgument='<%#Eval("ConcertID") %>'
                                                    CommandName="LearnMore" Width="94" Height="19" runat="server" />
                                </div>

                            </div>
                        </div>
                        <div class="DotImage">
                        </div>
                    </ItemTemplate>
                </asp:DataList>

            </div>

                <asp:DataList ID="dlConcerts0" runat="server" OnItemDataBound="dlConcerts_ItemDataBound"
                    RepeatColumns="1" OnItemCommand="dlConcerts_ItemCommand" RepeatDirection="Vertical" 
                    >
                    <ItemTemplate>
<div id="divHr0" runat="server" class="DivHRConcerts">


                        <div class="DivInnerHRConcerts">

                            2011-2012 Concert Season

                        </div>

                                    </div>

                        <div class="LeftConcertsContainer">
                            <div class="LeftConcertsImageContainer">
                                <img src='ConcertImages/<%#Eval("ConcertImage") %>' alt='<%#Eval("ConcertImage") %>'
                                    title='<%#Eval("ConcertImage") %>' />
                            </div>
                            <div class="LeftConcertsHeading">
                                <span class="HeadingGreen">
                                    <%#Eval("ConcertTitle") %></span><br />
                                <%-- DATALIST FOR CONCERT DATE IMAGE --%>
                                <asp:DataList ID="dlConcertDates" runat="server">
                                    <ItemTemplate>
                                        <span class="ConcertsTime">
                                            <%#Eval("ConcertDate") %></span>
                                    </ItemTemplate>
                                </asp:DataList>
                            </div>
                            <div class="ConcertsLeftTextArea">
                                <%-- DATALIST FOR CONCERT GUESTS IMAGE --%>
                                <asp:DataList ID="dlConcertGuests" runat="server" RepeatColumns="1" RepeatDirection="Vertical">
                                    <ItemTemplate>
                                        <table cellpadding="0" cellspacing="0" border="0" width="100%">
                                            <tr>
                                                <td>
                                                    <%#Eval("GuestName") %><span>, </span><%#Eval("InstrumentName") %>
                                                </td>
                                            </tr>
                                        </table>
                                    </ItemTemplate>
                                </asp:DataList>
                            </div>
                            <div class="ConcertsRightTextContainer">
                                <div class="ConcertsRightTextArea">
                                    <%-- DATALIST FOR CONCERT REPERTORIE IMAGE --%>
                                    <asp:DataList ID="dlRepetoire" runat="server" RepeatColumns="1" RepeatDirection="Vertical">
                                         <HeaderTemplate>
                                                        <table cellpadding="0" cellspacing="0" border="0" width="212px">
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <tr>
                                                            <td valign="top" style="width:90px">
                                                                <%#Eval("RepertoireName") %>
                                                                 
                                                            </td>
<td style="width:10px">
 
</td>
                                                            <td valign="top">
                                                                <%#Eval("RepertoireTitle")%>
                                                            </td>
                                                        </tr>
                                                    </ItemTemplate>
                                                    <FooterTemplate>
                                                        </table></FooterTemplate>
                                    </asp:DataList>
                                </div>



                                <div class="ConcertsButtonContainer" >
                                <div class="LearnMoreButton" ><a href="Content.aspx?ModuleID=63">
                                                        <img src="Images/SubscribeButton.jpg" border="0" /></a></div>
<div class="OrderTicketsButton" id="div2" runat="server"><asp:ImageButton ID="btnLearnMore" ImageUrl="Images/LearnMore.jpg" CommandArgument='<%#Eval("ConcertID") %>'
                                                    CommandName="LearnMore" Width="94" Height="19" runat="server" />
                                                    </div>
                                <div class="OrderTicketsButton" id="divSingleTicket0" runat="server">
                                  <div id="sddm0"  onmouseover="mopen('<%#Eval("ConcertID") %>')"
                                        onmouseout="mclosetime()">
                                        <img src="Images/OrderTickets.jpg" id="imgOrder0" style="cursor: pointer;" runat="server"
                                            width="111" height="19" /><br />
                                        <div id='<%#Eval("ConcertID") %>0' onmouseover="mcancelclosetime();" 
                                            onmouseout="mclosetime()">
                                            <table id="tableProjectList0" runat="server" cellpadding="0" cellspacing="0" 
                                                border="0">
                                            </table>
                                        </div>
                                    </div>
                                </div>

                                </div>
                                <div class="SubscribeButton" id="divSubscribe0" runat="server" >
                                <asp:ImageButton ID="btnLearnMore1" ImageUrl="Images/LearnMore.jpg" CommandArgument='<%#Eval("ConcertID") %>'
                                                    CommandName="LearnMore" Width="94" Height="19" runat="server" />
                                </div>

                            </div>
                        </div>
                        <div class="DotImage">
                        </div>
                    </ItemTemplate>
                </asp:DataList>

        </div>

</asp:Content>

when i used it into coding then it gives error dlConcerts0 does not exist

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

独夜无伴 2024-10-27 17:59:17

您必须从上层 DataList 控件中找到您的 DataList 控件,例如......

DataList dl = (DataList)dlConcerts.FindControl("dlConcerts0");

you have to find your DataList Control from your upper DataList control like..

DataList dl = (DataList)dlConcerts.FindControl("dlConcerts0");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文