using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
using System.Collections;

public partial class _Default : System.Web.UI.Page 
{
    NorthWind.ScheduleDataTable dt;

    protected override void OnInit(EventArgs e)
    {

    }

    protected void ItemDataBound(object sender, RadListBoxItemEventArgs e)
    {
        DataRowView row = e.Item.DataItem as DataRowView;
        bool reOccur = false;
        bool.TryParse(row["ReOccur"].ToString(), out reOccur);
        if (reOccur == true)
        {
            e.Item.Enabled = false;
        }

        string text = row["Subject"].ToString();
        if (text == "8")
        {
            e.Item.Selected = true;
        }
    }

 

    private void UpdateData()
    {
        NorthWindTableAdapters.ScheduleTableAdapter adapter = new NorthWindTableAdapters.ScheduleTableAdapter();
        dt = new NorthWind.ScheduleDataTable();
        adapter.Fill(dt);
        dt.DefaultView.Sort = "SortOrder";


        radGrid.DataSource = dt.DefaultView;
        radGrid.DataBind();
    }

    protected void Page_Load(object sender, EventArgs e)
    {

        if (this.IsPostBack == false)
        {
            UpdateData();
        }
        else
        {
            NorthWindTableAdapters.ScheduleTableAdapter adapter = new NorthWindTableAdapters.ScheduleTableAdapter();
            dt = new NorthWind.ScheduleDataTable();
            adapter.Fill(dt);
            dt.DefaultView.Sort = "SortOrder";

        }


    }
}