protected void Save_Click(Object sender, EventArgs e)
 {
     MusicCategories _cat = new MusicCategories(this.ConnectionString);
     _cat.Description = txt_Description.Text;
     if (!_cat.Save())
     {
         lbl_Error.Text = "An unexpected error has occurred. Please try again.";
     }
     else
     {
         lbl_Error.Text = "";
         txt_Description.Text = "";
         BindData();
     }
 }
    protected void Category_OnUpdateCommand(Object sender, DataGridCommandEventArgs e)
    {
        MusicCategories _cat = new MusicCategories(this.ConnectionString);
        String _id = dg_category.DataKeys[e.Item.ItemIndex].ToString();
        _cat.ID = _id;
        _cat.Description = ((TextBox)e.Item.FindControl("txt_Desc")).Text;
        _cat.Sort = Convert.ToInt32(((TextBox)e.Item.FindControl("txt_Sort")).Text);
        _cat.Default = ((CheckBox)e.Item.FindControl("ch_Default")).Checked;

        if (!_cat.Save())
        {
            lbl_Error.Text = "An unexpected error has occurred. Please try again.";
        }
        else
        {
            lbl_Error.Text = "";
            dg_category.EditItemIndex = -1;
            val_Desc.Enabled = true;
            BindData();
        }
    }