Ramco Ramco

Ramco Ramco

  • 442
  • 3.4k
  • 528.5k

Error - An invalid data source is being used for rptData

Dec 12 2022 4:16 AM

Hi

  I am getting error - +        $exception    {"An invalid data source is being used for rptData. A valid data source must implement either IListSource or IEnumerable."}    System.ArgumentException

 public void GetChannelList()
    {
        YouTubeService yt = new YouTubeService(new BaseClientService.Initializer() { ApiKey = "AAAAAA" });


        var searchListRequest = yt.Search.List("snippet");
        searchListRequest.ChannelId = "as8AA1A";
        var Result = searchListRequest.Execute();
        if (Result != null)
        {
            rptData.DataSource = Result;
            rptData.DataBind();
        }
    }

<table class='table table-bordered table-hover' id='tblParticipant'>
                <thead>
                    <tr>
                        <th class='nosort2'>#</th>
                        <th>ID</th>
                        <th>Snippet</th>
                    </tr>
                </thead>
                <tbody>
                    <asp:Repeater ID="rptData" runat="server">
                        <ItemTemplate>
                            <tr>
                                <td>
                                    <asp:Literal ID="ltrlNum" Text="<%# Convert.ToString(Container.ItemIndex + 1) %>" runat="server"></asp:Literal>

                                                        
                                <td>
                                    <asp:Literal ID="ltrlId" runat="server" Text='<%# Eval("Id.VideoId") %>'></asp:Literal>
                                </td>
                                <td>
                                    <asp:Literal ID="ltrlVideoName" runat="server" Text='<%# Eval("Snippet.Title") %>'></asp:Literal>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </tbody>
            </table>

 

Thanks


Answers (1)