using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Init(object sender, EventArgs e)
    {
        RadGrid1.ItemCommand += new GridCommandEventHandler(RadGrid1_ItemCommand);
        RadGrid1.NeedDataSource += new GridNeedDataSourceEventHandler(RadGrid1_NeedDataSource);
        RadGrid1.ItemDataBound += new GridItemEventHandler(RadGrid1_ItemDataBound);
        RadGrid1.ItemCreated += new GridItemEventHandler(RadGrid1_ItemCreated);
        
        
    }

    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridEditableItem && e.Item.IsInEditMode)
        {
            GridEditableItem item = e.Item as GridEditableItem;
            RadComboBox combo = item["Supplier"].FindControl("rcmbSuppliers") as RadComboBox;
            combo.DataSource = SqlDataSource3.Select(new DataSourceSelectArguments());
        }
    }

    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {

    }

    protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        
    }

    protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == "RowClick")
        {
            
        }
     }

    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
        {
            if (item.IsInEditMode)
            {
                item.Selected = true;
            }
        }
    }

}
