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

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (RadGrid1.DataSourceID == "SqlDataSource1")
        {
            RadGrid1.DataSourceID = "SqlDataSource2";
            RadGrid1.MasterTableView.DataKeyNames = new string[] { "TerritoryID" };
        }

        else
        {
            RadGrid1.DataSourceID = "SqlDataSource1";
            RadGrid1.MasterTableView.DataKeyNames = new string[] { "ProductID" };
        }
        RadGrid1.Rebind();
    }
}
