locked
GridView.InsertMethod RRS feed

  • Question

  • User-879727125 posted

    See GridView Class (System.Web.UI.WebControls), specifically the InsertMethod property. Nothing says the method is unsupported.

    See "Add new records" in Updating, deleting, and creating data with model binding and web forms. It says:

    The GridView control does not include the InsertMethod property

    What? So does that mean that the GridView documentation is a huge waste of time? If GridView does not support InsertMethod then it sure wasted my time.

    Unless I am wrong and GridView does support InsertMethod, this is not really a question but I just wanted to express that I was surprised. I already submitted feedback for that page about that.

    Tuesday, February 12, 2019 12:28 AM

All replies

  • User61956409 posted

    Hi Sam Hobbs,

    If you check the definition of GridView class, you will find it inherits from CompositeDataBoundControl etc, like below.

    public class GridView : CompositeDataBoundControl, IPostBackContainer, IPostBackEventHandler, ICallbackContainer, ICallbackEventHandler, IPersistedSelector, IDataKeysControl, IDataBoundListControl, IDataBoundControl, IFieldControl

    And in CompositeDataBoundControl, we can find that it provides InsertMethod property that is a protected internal property.

    protected internal string InsertMethod { get; set; }

    So as you find in GridView Class (System.Web.UI.WebControls), the property is inherited from CompositeDataBoundControl.

    InsertMethod  Gets or sets the name of the method to call in order to insert data. (Inherited from CompositeDataBoundControl)

    Besides, if you check the definition of FormView class, you can find it explicitly define a public property InsertMethod.

    //
    // Summary:
    //     Gets or sets the name of the method on the page that is called when the control
    //     performs an insert operation.
    //
    // Returns:
    //     The name of the method on the page that is called when the control performs an
    //     insert operation.
    [DefaultValue("")]
    [Themeable(false)]
    [WebCategoryAttribute("Data")]
    [WebSysDescriptionAttribute("DataBoundControl_InsertMethod")]
    public virtual string InsertMethod { get; set; }

    With Regards,

    Fei Han

    Wednesday, February 13, 2019 3:14 AM
  • User-879727125 posted

    So does that mean that the GridView control does not support the InsertMethod attribute? That is a simple yes or no question. If the GridView control does not support the InsertMethod attribute then the documentation should say so. We should not have to go hunting down every little detail.

    Thursday, February 14, 2019 6:10 PM
  • User61956409 posted

    Hi Sam Hobbs,

    Firstly, yes, the GridView control does not support the InsertMethod attribute.

    Besides, in GridView Class (System.Web.UI.WebControls), it already note that the InsertMethod property is inherited from CompositeDataBoundControl. The content of documentation is also ok.

    With Regards,

    Fei Han

    Friday, February 15, 2019 10:03 AM