using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;

namespace MvcApplication3.Views.Home
{
    public partial class ViewUserControl1 : System.Web.Mvc.ViewUserControl
    {
        public AjaxOptions options = new AjaxOptions();

        protected void Page_Load(object sender, EventArgs e)
        {
            options.UpdateTargetId = "page";
            options.HttpMethod = "Post";
            RadGrid1.DataSource = ViewData.Model;

            RadGrid1.PageSize = (int)Session["PageSize"];

            if (Session["ItemToSelect"] != null)
            {
                RadGrid1.SelectedIndexes.Add(new int[] { int.Parse(Session["ItemToSelect"].ToString()) });
            }

            if (Session["ItemToEdit"] != null)
            {
                RadGrid1.EditIndexes.Add(new int[] { int.Parse(Session["ItemToEdit"].ToString()) });
            }

            if (Session["InitInsert"] != null)
            {
                RadGrid1.MasterTableView.IsItemInserted = true;
            }
        }
    }
}
