Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs')
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs303
1 files changed, 140 insertions, 163 deletions
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
index 435f248315e..967fc84fb83 100644
--- a/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridView.cs
@@ -40,13 +40,12 @@ using System.Reflection;
namespace System.Web.UI.WebControls
{
- [SupportsEventValidation]
[DesignerAttribute ("System.Web.UI.Design.WebControls.GridViewDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
[ControlValuePropertyAttribute ("SelectedValue")]
[DefaultEventAttribute ("SelectedIndexChanged")]
[AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
- public class GridView: CompositeDataBoundControl, ICallbackEventHandler, ICallbackContainer, IPostBackEventHandler, IPostBackContainer
+ public class GridView: CompositeDataBoundControl, ICallbackEventHandler, ICallbackContainer
{
Table table;
GridViewRowCollection rows;
@@ -307,7 +306,7 @@ namespace System.Web.UI.WebControls
[WebCategoryAttribute ("Paging")]
[DefaultValueAttribute (false)]
- public virtual bool AllowPaging {
+ public bool AllowPaging {
get {
object ob = ViewState ["AllowPaging"];
if (ob != null) return (bool) ob;
@@ -321,7 +320,7 @@ namespace System.Web.UI.WebControls
[WebCategoryAttribute ("Behavior")]
[DefaultValueAttribute (false)]
- public virtual bool AllowSorting {
+ public bool AllowSorting {
get {
object ob = ViewState ["AllowSorting"];
if (ob != null) return (bool) ob;
@@ -333,11 +332,11 @@ namespace System.Web.UI.WebControls
}
}
- [WebCategoryAttribute ("Styles")]
+ [WebCategoryAttribute ("Styles")]
[PersistenceMode (PersistenceMode.InnerProperty)]
[NotifyParentProperty (true)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
- public TableItemStyle AlternatingRowStyle {
+ public virtual TableItemStyle AlternatingRowStyle {
get {
if (alternatingRowStyle == null) {
alternatingRowStyle = new TableItemStyle ();
@@ -432,7 +431,7 @@ namespace System.Web.UI.WebControls
[WebCategoryAttribute ("Accessibility")]
[DefaultValueAttribute ("")]
[LocalizableAttribute (true)]
- public virtual string Caption {
+ public string Caption {
get {
object ob = ViewState ["Caption"];
if (ob != null) return (string) ob;
@@ -534,7 +533,7 @@ namespace System.Web.UI.WebControls
[WebCategoryAttribute ("Misc")]
[DefaultValueAttribute (-1)]
- public virtual int EditIndex {
+ public int EditIndex {
get {
return editIndex;
}
@@ -544,11 +543,11 @@ namespace System.Web.UI.WebControls
}
}
- [WebCategoryAttribute ("Styles")]
+ [WebCategoryAttribute ("Styles")]
[PersistenceMode (PersistenceMode.InnerProperty)]
[NotifyParentProperty (true)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
- public TableItemStyle EditRowStyle {
+ public virtual TableItemStyle EditRowStyle {
get {
if (editRowStyle == null) {
editRowStyle = new TableItemStyle ();
@@ -559,11 +558,11 @@ namespace System.Web.UI.WebControls
}
}
- [WebCategoryAttribute ("Styles")]
+ [WebCategoryAttribute ("Styles")]
[PersistenceMode (PersistenceMode.InnerProperty)]
[NotifyParentProperty (true)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
- public TableItemStyle EmptyDataRowStyle {
+ public virtual TableItemStyle EmptyDataRowStyle {
get {
if (emptyDataRowStyle == null) {
emptyDataRowStyle = new TableItemStyle ();
@@ -575,10 +574,10 @@ namespace System.Web.UI.WebControls
}
[DefaultValue (null)]
- [TemplateContainer (typeof(GridViewRow), BindingDirection.OneWay)]
+ [TemplateContainer (typeof(GridView), BindingDirection.OneWay)]
[PersistenceMode (PersistenceMode.InnerProperty)]
- [Browsable (false)]
- public virtual ITemplate EmptyDataTemplate {
+ [Browsable (false)]
+ public ITemplate EmptyDataTemplate {
get { return emptyDataTemplate; }
set { emptyDataTemplate = value; RequireBinding (); }
}
@@ -622,12 +621,12 @@ namespace System.Web.UI.WebControls
}
}
- [WebCategoryAttribute ("Styles")]
+ [WebCategoryAttribute ("Styles")]
[PersistenceMode (PersistenceMode.InnerProperty)]
[NotifyParentProperty (true)]
[DefaultValue (null)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
- public TableItemStyle FooterStyle {
+ public virtual TableItemStyle FooterStyle {
get {
if (footerStyle == null) {
footerStyle = new TableItemStyle ();
@@ -661,12 +660,12 @@ namespace System.Web.UI.WebControls
}
}
- [WebCategoryAttribute ("Styles")]
+ [WebCategoryAttribute ("Styles")]
[PersistenceMode (PersistenceMode.InnerProperty)]
[NotifyParentProperty (true)]
[DefaultValue (null)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
- public TableItemStyle HeaderStyle {
+ public virtual TableItemStyle HeaderStyle {
get {
if (headerStyle == null) {
headerStyle = new TableItemStyle ();
@@ -693,7 +692,7 @@ namespace System.Web.UI.WebControls
[BrowsableAttribute (false)]
[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
- public virtual int PageCount {
+ public int PageCount {
get {
if (pageCount != -1) return pageCount;
EnsureDataBound ();
@@ -704,7 +703,7 @@ namespace System.Web.UI.WebControls
[WebCategoryAttribute ("Paging")]
[BrowsableAttribute (true)]
[DefaultValueAttribute (0)]
- public virtual int PageIndex {
+ public int PageIndex {
get {
return pageIndex;
}
@@ -716,7 +715,7 @@ namespace System.Web.UI.WebControls
[DefaultValueAttribute (10)]
[WebCategoryAttribute ("Paging")]
- public virtual int PageSize {
+ public int PageSize {
get {
object ob = ViewState ["PageSize"];
if (ob != null) return (int) ob;
@@ -732,7 +731,7 @@ namespace System.Web.UI.WebControls
[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Content)]
[NotifyParentPropertyAttribute (true)]
[PersistenceModeAttribute (PersistenceMode.InnerProperty)]
- public virtual PagerSettings PagerSettings {
+ public PagerSettings PagerSettings {
get {
if (pagerSettings == null) {
pagerSettings = new PagerSettings (this);
@@ -743,11 +742,11 @@ namespace System.Web.UI.WebControls
}
}
- [WebCategoryAttribute ("Styles")]
+ [WebCategoryAttribute ("Styles")]
[PersistenceMode (PersistenceMode.InnerProperty)]
[NotifyParentProperty (true)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
- public TableItemStyle PagerStyle {
+ public virtual TableItemStyle PagerStyle {
get {
if (pagerStyle == null) {
pagerStyle = new TableItemStyle ();
@@ -763,15 +762,15 @@ namespace System.Web.UI.WebControls
/* DataControlPagerCell isnt specified in the docs */
//[TemplateContainer (typeof(DataControlPagerCell), BindingDirection.OneWay)]
[PersistenceMode (PersistenceMode.InnerProperty)]
- [Browsable (false)]
- public virtual ITemplate PagerTemplate {
+ [Browsable (false)]
+ public ITemplate PagerTemplate {
get { return pagerTemplate; }
set { pagerTemplate = value; RequireBinding (); }
}
[DefaultValueAttribute ("")]
[WebCategoryAttribute ("Accessibility")]
- // [TypeConverterAttribute (typeof(System.Web.UI.Design.DataColumnSelectionConverter)]
+// [TypeConverterAttribute (typeof(System.Web.UI.Design.DataColumnSelectionConverter)]
public virtual string RowHeaderColumn {
get {
object ob = ViewState ["RowHeaderColumn"];
@@ -793,11 +792,11 @@ namespace System.Web.UI.WebControls
}
}
- [WebCategoryAttribute ("Styles")]
+ [WebCategoryAttribute ("Styles")]
[PersistenceMode (PersistenceMode.InnerProperty)]
[NotifyParentProperty (true)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
- public TableItemStyle RowStyle {
+ public virtual TableItemStyle RowStyle {
get {
if (rowStyle == null) {
rowStyle = new TableItemStyle ();
@@ -821,18 +820,18 @@ namespace System.Web.UI.WebControls
[BindableAttribute (true)]
[DefaultValueAttribute (-1)]
- public virtual int SelectedIndex {
+ public int SelectedIndex {
get {
return selectedIndex;
}
set {
- if (Rows != null && selectedIndex >= 0 && selectedIndex < Rows.Count) {
+ if (selectedIndex >= 0 && selectedIndex < Rows.Count) {
int oldIndex = selectedIndex;
selectedIndex = -1;
Rows [oldIndex].RowState = GetRowState (oldIndex);
}
selectedIndex = value;
- if (Rows != null && selectedIndex >= 0 && selectedIndex < Rows.Count) {
+ if (selectedIndex >= 0 && selectedIndex < Rows.Count) {
Rows [selectedIndex].RowState = GetRowState (selectedIndex);
}
}
@@ -849,11 +848,11 @@ namespace System.Web.UI.WebControls
}
}
- [WebCategoryAttribute ("Styles")]
+ [WebCategoryAttribute ("Styles")]
[PersistenceMode (PersistenceMode.InnerProperty)]
[NotifyParentProperty (true)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
- public TableItemStyle SelectedRowStyle {
+ public virtual TableItemStyle SelectedRowStyle {
get {
if (selectedRowStyle == null) {
selectedRowStyle = new TableItemStyle ();
@@ -865,7 +864,7 @@ namespace System.Web.UI.WebControls
}
[BrowsableAttribute (false)]
- public object SelectedValue {
+ public virtual object SelectedValue {
get {
if (SelectedDataKey != null)
return SelectedDataKey.Value;
@@ -995,9 +994,9 @@ namespace System.Web.UI.WebControls
object fitem = null;
prop_type = null;
PropertyInfo prop_item = source.DataSource.GetType().GetProperty("Item",
- BindingFlags.Instance | BindingFlags.Static |
- BindingFlags.Public, null, null,
- new Type[] { typeof(int) }, null);
+ BindingFlags.Instance | BindingFlags.Static |
+ BindingFlags.Public, null, null,
+ new Type[] { typeof(int) }, null);
if (prop_item != null) {
prop_type = prop_item.PropertyType;
@@ -1155,7 +1154,7 @@ namespace System.Web.UI.WebControls
table.Rows.Add (row);
InitializeRow (row, fields);
if (dataBinding) {
- // row.DataBind ();
+// row.DataBind ();
OnRowDataBound (new GridViewRowEventArgs (row));
if (EditIndex == row.RowIndex)
oldEditValues = new DataKey (GetRowValues (row, false, true));
@@ -1248,16 +1247,16 @@ namespace System.Web.UI.WebControls
bool accessibleHeader = false;
switch (row.RowType) {
- case DataControlRowType.Header:
- ctype = DataControlCellType.Header;
- accessibleHeader = UseAccessibleHeader;
- break;
- case DataControlRowType.Footer:
- ctype = DataControlCellType.Footer;
- break;
- default:
- ctype = DataControlCellType.DataCell;
- break;
+ case DataControlRowType.Header:
+ ctype = DataControlCellType.Header;
+ accessibleHeader = UseAccessibleHeader;
+ break;
+ case DataControlRowType.Footer:
+ ctype = DataControlCellType.Footer;
+ break;
+ default:
+ ctype = DataControlCellType.DataCell;
+ break;
}
for (int n=0; n<fields.Length; n++) {
@@ -1384,11 +1383,6 @@ namespace System.Web.UI.WebControls
return base.OnBubbleEvent (source, e);
}
- void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
- {
- RaisePostBackEvent (eventArgument);
- }
-
// This is prolly obsolete
protected virtual void RaisePostBackEvent (string eventArgument)
{
@@ -1403,69 +1397,69 @@ namespace System.Web.UI.WebControls
{
switch (eventName)
{
- case DataControlCommands.PageCommandName:
- int newIndex = -1;
- switch (param) {
+ case DataControlCommands.PageCommandName:
+ int newIndex = -1;
+ switch (param) {
+ case DataControlCommands.FirstPageCommandArgument:
+ newIndex = 0;
+ break;
+ case DataControlCommands.LastPageCommandArgument:
+ newIndex = PageCount - 1;
+ break;
+ case DataControlCommands.NextPageCommandArgument:
+ if (PageIndex < PageCount - 1) newIndex = PageIndex + 1;
+ break;
+ case DataControlCommands.PreviousPageCommandArgument:
+ if (PageIndex > 0) newIndex = PageIndex - 1;
+ break;
+ default:
+ newIndex = int.Parse (param) - 1;
+ break;
+ }
+ ShowPage (newIndex);
+ break;
+
case DataControlCommands.FirstPageCommandArgument:
- newIndex = 0;
+ ShowPage (0);
break;
+
case DataControlCommands.LastPageCommandArgument:
- newIndex = PageCount - 1;
+ ShowPage (PageCount - 1);
break;
+
case DataControlCommands.NextPageCommandArgument:
- if (PageIndex < PageCount - 1) newIndex = PageIndex + 1;
+ if (PageIndex < PageCount - 1)
+ ShowPage (PageIndex + 1);
break;
+
case DataControlCommands.PreviousPageCommandArgument:
- if (PageIndex > 0) newIndex = PageIndex - 1;
+ if (PageIndex > 0)
+ ShowPage (PageIndex - 1);
break;
- default:
- newIndex = int.Parse (param) - 1;
- break;
- }
- ShowPage (newIndex);
- break;
- case DataControlCommands.FirstPageCommandArgument:
- ShowPage (0);
- break;
-
- case DataControlCommands.LastPageCommandArgument:
- ShowPage (PageCount - 1);
- break;
-
- case DataControlCommands.NextPageCommandArgument:
- if (PageIndex < PageCount - 1)
- ShowPage (PageIndex + 1);
- break;
-
- case DataControlCommands.PreviousPageCommandArgument:
- if (PageIndex > 0)
- ShowPage (PageIndex - 1);
- break;
-
- case DataControlCommands.SelectCommandName:
- SelectRow (int.Parse (param));
- break;
+ case DataControlCommands.SelectCommandName:
+ SelectRow (int.Parse (param));
+ break;
- case DataControlCommands.EditCommandName:
- EditRow (int.Parse (param));
- break;
+ case DataControlCommands.EditCommandName:
+ EditRow (int.Parse (param));
+ break;
- case DataControlCommands.UpdateCommandName:
- UpdateRow (EditIndex, true);
- break;
+ case DataControlCommands.UpdateCommandName:
+ UpdateRow (EditIndex, true);
+ break;
- case DataControlCommands.CancelCommandName:
- CancelEdit ();
- break;
+ case DataControlCommands.CancelCommandName:
+ CancelEdit ();
+ break;
- case DataControlCommands.DeleteCommandName:
- DeleteRow (int.Parse (param));
- break;
+ case DataControlCommands.DeleteCommandName:
+ DeleteRow (int.Parse (param));
+ break;
- case DataControlCommands.SortCommandName:
- Sort (param);
- break;
+ case DataControlCommands.SortCommandName:
+ Sort (param);
+ break;
}
}
@@ -1483,7 +1477,7 @@ namespace System.Web.UI.WebControls
Sort (newSortExpression, newDirection);
}
- public virtual void Sort (string newSortExpression, SortDirection newSortDirection)
+ public void Sort (string newSortExpression, SortDirection newSortDirection)
{
GridViewSortEventArgs args = new GridViewSortEventArgs (newSortExpression, newSortDirection);
OnSorting (args);
@@ -1559,7 +1553,7 @@ namespace System.Web.UI.WebControls
EndRowEdit ();
}
- bool UpdateCallback (int recordsAffected, Exception exception)
+ bool UpdateCallback (int recordsAffected, Exception exception)
{
GridViewUpdatedEventArgs dargs = new GridViewUpdatedEventArgs (recordsAffected, exception, currentEditRowKeys, currentEditOldValues, currentEditNewValues);
OnRowUpdated (dargs);
@@ -1570,7 +1564,7 @@ namespace System.Web.UI.WebControls
return dargs.ExceptionHandled;
}
- public virtual void DeleteRow (int rowIndex)
+ public void DeleteRow (int rowIndex)
{
GridViewRow row = Rows [rowIndex];
currentEditRowKeys = DataKeys [rowIndex].Values;
@@ -1591,7 +1585,7 @@ namespace System.Web.UI.WebControls
}
}
- bool DeleteCallback (int recordsAffected, Exception exception)
+ bool DeleteCallback (int recordsAffected, Exception exception)
{
GridViewDeletedEventArgs dargs = new GridViewDeletedEventArgs (recordsAffected, exception, currentEditRowKeys, currentEditNewValues);
OnRowDeleted (dargs);
@@ -1625,7 +1619,7 @@ namespace System.Web.UI.WebControls
object bstate = base.SaveControlState ();
return new object[] {
bstate, pageIndex, pageCount, selectedIndex, editIndex, sortExpression, sortDirection
- };
+ };
}
protected override void TrackViewState()
@@ -1720,13 +1714,12 @@ namespace System.Web.UI.WebControls
if (states[12] != null && oldEditValues != null) ((IStateManager)oldEditValues).LoadViewState (states[12]);
}
- void ICallbackEventHandler.RaiseCallbackEvent (string eventArgs)
+ string ICallbackEventHandler.RaiseCallbackEvent (string eventArgs)
{
- RaiseCallbackEvent (eventArgs);
+ return RaiseCallbackEvent (eventArgs);
}
- string callbackResult;
- protected virtual void RaiseCallbackEvent (string eventArgs)
+ protected virtual string RaiseCallbackEvent (string eventArgs)
{
string[] clientData = eventArgs.Split ('|');
pageIndex = int.Parse (clientData[0]);
@@ -1742,19 +1735,9 @@ namespace System.Web.UI.WebControls
HtmlTextWriter writer = new HtmlTextWriter (sw);
RenderGrid (writer);
- callbackResult = sw.ToString ();
+ return sw.ToString ();
}
- string ICallbackEventHandler.GetCallbackResult ()
- {
- return GetCallbackResult ();
- }
-
- protected virtual string GetCallbackResult ()
- {
- return callbackResult;
- }
-
string ICallbackContainer.GetCallbackScript (IButtonControl control, string argument)
{
return GetCallbackScript (control, argument);
@@ -1793,7 +1776,7 @@ namespace System.Web.UI.WebControls
Page.ClientScript.RegisterStartupScript (typeof(TreeView), this.UniqueID, script, true);
// Make sure the basic script infrastructure is rendered
- Page.ClientScript.GetCallbackEventReference (this, "null", "", "null");
+ Page.ClientScript.GetCallbackEventReference (this, "null", "", "null");
Page.ClientScript.GetPostBackClientHyperlink (this, "");
}
}
@@ -1812,21 +1795,21 @@ namespace System.Web.UI.WebControls
void RenderGrid (HtmlTextWriter writer)
{
switch (GridLines) {
- case GridLines.Horizontal:
- writer.AddAttribute (HtmlTextWriterAttribute.Rules, "rows");
- writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
- break;
- case GridLines.Vertical:
- writer.AddAttribute (HtmlTextWriterAttribute.Rules, "cols");
- writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
- break;
- case GridLines.Both:
- writer.AddAttribute (HtmlTextWriterAttribute.Rules, "all");
- writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
- break;
- default:
- writer.AddAttribute (HtmlTextWriterAttribute.Border, "0");
- break;
+ case GridLines.Horizontal:
+ writer.AddAttribute (HtmlTextWriterAttribute.Rules, "rows");
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
+ break;
+ case GridLines.Vertical:
+ writer.AddAttribute (HtmlTextWriterAttribute.Rules, "cols");
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
+ break;
+ case GridLines.Both:
+ writer.AddAttribute (HtmlTextWriterAttribute.Rules, "all");
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
+ break;
+ default:
+ writer.AddAttribute (HtmlTextWriterAttribute.Border, "0");
+ break;
}
writer.AddAttribute (HtmlTextWriterAttribute.Cellspacing, "0");
@@ -1836,20 +1819,20 @@ namespace System.Web.UI.WebControls
foreach (GridViewRow row in table.Rows)
{
switch (row.RowType) {
- case DataControlRowType.Header:
- if (headerStyle != null)headerStyle.AddAttributesToRender (writer, row);
- break;
- case DataControlRowType.Footer:
- if (footerStyle != null) footerStyle.AddAttributesToRender (writer, row);
- break;
- case DataControlRowType.Pager:
- if (pagerStyle != null) pagerStyle.AddAttributesToRender (writer, row);
- break;
- case DataControlRowType.EmptyDataRow:
- if (emptyDataRowStyle != null) emptyDataRowStyle.AddAttributesToRender (writer, row);
- break;
- default:
- break;
+ case DataControlRowType.Header:
+ if (headerStyle != null)headerStyle.AddAttributesToRender (writer, row);
+ break;
+ case DataControlRowType.Footer:
+ if (footerStyle != null) footerStyle.AddAttributesToRender (writer, row);
+ break;
+ case DataControlRowType.Pager:
+ if (pagerStyle != null) pagerStyle.AddAttributesToRender (writer, row);
+ break;
+ case DataControlRowType.EmptyDataRow:
+ if (emptyDataRowStyle != null) emptyDataRowStyle.AddAttributesToRender (writer, row);
+ break;
+ default:
+ break;
}
if ((row.RowState & DataControlRowState.Normal) != 0 && rowStyle != null)
@@ -1868,9 +1851,9 @@ namespace System.Web.UI.WebControls
if (fcell != null) {
Style cellStyle = null;
switch (row.RowType) {
- case DataControlRowType.Header: cellStyle = fcell.ContainingField.HeaderStyle; break;
- case DataControlRowType.Footer: cellStyle = fcell.ContainingField.FooterStyle; break;
- default: cellStyle = fcell.ContainingField.ItemStyle; break;
+ case DataControlRowType.Header: cellStyle = fcell.ContainingField.HeaderStyle; break;
+ case DataControlRowType.Footer: cellStyle = fcell.ContainingField.FooterStyle; break;
+ default: cellStyle = fcell.ContainingField.ItemStyle; break;
}
if (cellStyle != null)
cellStyle.AddAttributesToRender (writer, cell);
@@ -1881,12 +1864,6 @@ namespace System.Web.UI.WebControls
}
table.RenderEndTag (writer);
}
-
- [MonoTODO]
- PostBackOptions IPostBackContainer.GetPostBackOptions (IButtonControl control)
- {
- throw new NotImplementedException ();
- }
}
}