System.Web.UI.WebControls.DataGrid.OnBubbleEvent C# (CSharp) Method

OnBubbleEvent() protected method

protected OnBubbleEvent ( object source, EventArgs e ) : bool
source object
e System.EventArgs
return bool
		protected override bool OnBubbleEvent (object source, EventArgs e)
		{
			DataGridCommandEventArgs de = e as DataGridCommandEventArgs;

			if (de == null)
				return false;

			string cn = de.CommandName;
			CultureInfo inv = Helpers.InvariantCulture;

			OnItemCommand (de);
			if (String.Compare (cn, CancelCommandName, true, inv) == 0) {
				OnCancelCommand (de);
			} else if (String.Compare (cn, DeleteCommandName, true, inv) == 0) {
				OnDeleteCommand (de);
			} else if (String.Compare (cn, EditCommandName, true, inv) == 0) {
				OnEditCommand (de);
			} else if (String.Compare (cn, SelectCommandName, true, inv) == 0) {
				SelectedIndex = de.Item.ItemIndex;
				OnSelectedIndexChanged (de);
			} else if (String.Compare (cn, SortCommandName, true, inv) == 0) {
				DataGridSortCommandEventArgs se = new DataGridSortCommandEventArgs (de.CommandSource, de);
				OnSortCommand (se);
			} else if (String.Compare (cn, UpdateCommandName, true, inv) == 0) {
				OnUpdateCommand (de);
			} else if (String.Compare (cn, PageCommandName, true, inv) == 0) {
				int new_index;
				if (String.Compare ((string) de.CommandArgument,
						    NextPageCommandArgument, true, inv) == 0) {
					new_index = CurrentPageIndex + 1;
				} else if (String.Compare ((string) de.CommandArgument,
							   PrevPageCommandArgument, true, inv) == 0) {
					new_index = CurrentPageIndex - 1;
				} else {
					// It seems to just assume it's an int and parses, no
					// checks to make sure its valid or anything.
					//  also it's always one less then specified, not sure
					// why that is.
					new_index = Int32.Parse ((string) de.CommandArgument, inv) - 1;
				}
				DataGridPageChangedEventArgs pc = new DataGridPageChangedEventArgs (
					de.CommandSource, new_index);
				OnPageIndexChanged (pc);
			}

			return true;
		}