// aspx page // -------------------------------------------------------------- // cs page protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindControls(); } } protected void BindControls() { this.gvCategories.DataSource = DAL.cCategories.GetAllCategories();// GetAllCategoriesSqlCached(); this.gvCategories.DataBind(); } protected void gvCategories_Sorting(object sender, GridViewSortEventArgs e) { if (e.SortExpression == "CategoryPkey") { this.lblGrid.Text = "You cant sort by ID"; } else { this.lblGrid.Text = "Sorting by " + e.SortExpression.ToString() + " in " + e.SortDirection.ToString() + " order..."; } }