I am getting this error

"Both DataSource and DataSourceID are defined on 'DataListCity'. Remove one definition."

This is the code from my Masterpage that is causing the error

<asp:DataList ID="DataListCity" runat="server" Width="100%" 
    onitemcommand="DataListCity_ItemCommand" CellPadding="4" 
    ForeColor="#333333" DataSourceID="SqlDataSource1">

    <ItemTemplate>
        CityId:
        <asp:Label ID="CityIdLabel" runat="server" Text='<%# Eval("CityId") %/>
        <br />
        CityName:
        <asp:Label ID="CityNameLabel" runat="server" Text='<%# Eval("CityName")%>' />
        <br />
        <br />
    </ItemTemplate>
</asp:DataList>

<asp:SqlDataSource
    ConnectionString="<%$ ConnectionStrings:HotelConnString %>" 
    ID="SqlDataSource1" runat="server"   
    SelectCommand="SELECT [CityId], [CityName], [Description] FROM [Categories]">
</asp:SqlDataSource>

Related posts

Recent Viewed