locked
How to Fire up EntityDataSource's Inserting Event? RRS feed

  • Question

  • User-1312304163 posted

    Hi:

    I try to implement a GridView which can insert data by using the footer row. I did it by using ObjectDataSource before.

    I put a imagebutton at Footer, and set the ImageButton.CommandName = "Insert".

    If I use ObjectDataSource, the only thing I need to is catch up the Command Insert at GridView's ItemCommand Event and fire up the ObjectDataSource.Insert().

    But it seems like the EntityDataSource doesn't have function like insert, very confusing how to fire up the Insert event like the DetailsView did with the EntityDataSource.

    Can anyone help?

     protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
            {
                if (e.CommandName.Equals("FooterCancel"))
                {
                    if (GridView1.FooterRow == null)
                    {
                        GridView1.DataBind();
                    }
                    GridView1.ShowFooter = false;
                }
                if (e.CommandName.Equals("Insert"))
                {
                   // ObjectDataSource1.Inser() If using ObjectDataSource
                   GridDataSource.Insert() ?;

                }
            }

     

     

     

    Friday, September 19, 2008 2:52 AM

Answers