using System;
using System.Collections.Generic;
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 OnNeedDAtaSource(object source, GridNeedDataSourceEventArgs e)
    {
        RadGrid1.DataSource = new List<Test> { new Test("qwe"), new Test("fth") };
    }

    protected void OnItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridEditableItem && e.Item.IsInEditMode)
        {
            var rvValue = (RequiredFieldValidator)e.Item.FindControl("rvValue");
            if (e.Item is GridEditFormInsertItem)
            {
                rvValue.ValidationGroup = "addRowValidation";
                ((e.Item as GridEditFormItem).FindControl("PerformInsertButton") as LinkButton).ValidationGroup = "addRowValidation";
            }
            else
            {
                rvValue.ValidationGroup = "editRowValidation";
                ((e.Item as GridEditFormItem).FindControl("UpdateButton") as LinkButton).ValidationGroup = "editRowValidation";
            }
        }
    }

    protected void OnItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridEditableItem && e.Item.IsInEditMode)
        {
            var rvValue = (RequiredFieldValidator)e.Item.FindControl("rvValue");
            if (e.Item is GridEditFormInsertItem)
            {
                //rvValue.ValidationGroup = "addRowValidation";
            }
            else
            {
                //rvValue.ValidationGroup = "editRowValidation";
            }
        }
    }
}
public class Test
{
    public Test(string name)
    {
        Name = name;
    }
    public string Name { get; set; }
}


