using System;
using System.Collections.Generic;
using System.Data;
using Telerik.Web.UI;
using TelerikTestGrid.Code;

namespace TelerikTestGrid
{
    public partial class TelerikTestUserControl : System.Web.UI.UserControl, ITelerikTestUserControl
    {
        protected void RadGridExternal_OnNeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            RadGridExternal.DataSource = LoadData();
        }
        protected void RadGridExternal_DataBinding(object sender, EventArgs e)
        {
            RadGridExternal.DataSource = LoadData();
        }

        public void SetData()
        {

            //  RadGridExternal.Rebind();
        }

        private static IEnumerable<TestItem> LoadData()
        {
            for (var i = 0; i < 50; i++)
            {
                yield return new TestItem(i, $"External Item {i}");
            }
        }

    }
}
