locked
Bug anyone with DynamicData controls RRS feed

  • Question

  • User1204604062 posted

     

    Hello, In all my pages of DYNAMIC DATA it happens to me.

     

     1. CLick on edit on the gridview to pass the data to the detailsview

    2. Delete a row on the gridview.

     

    then, the detailsview disappear

     

    Thx
    Tuesday, January 6, 2009 11:25 AM

Answers

  • User-1005219520 posted

    That's the expected behavior. Once you delete a selected entity, it disappears from the details view. Do you want to set the selected index and arbitrarily display the first entity (as on Page_Load)?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, January 6, 2009 4:57 PM

All replies

  • User-330204900 posted

    What you are saying is in the Details page you click the Delete link and it goes back to the List page? If I'm correct then this is normal, what would you like to happen?

    Tuesday, January 6, 2009 1:56 PM
  • User1204604062 posted

     I dont use the details page, I use ListDetails only, I want everything to be done in the same page.

     

    I dont think its normal!

    Tuesday, January 6, 2009 2:22 PM
  • User-1005219520 posted

    That's the expected behavior. Once you delete a selected entity, it disappears from the details view. Do you want to set the selected index and arbitrarily display the first entity (as on Page_Load)?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, January 6, 2009 4:57 PM
  • User1204604062 posted

     It makes sense, but the detailsview disappear and now there is no option to create a new entity.

     

    I did the following trick

     

    Just disable the delete image on edit mode.

     

      protected void OnGridViewSelectedIndexChanged(object sender, EventArgs e)
            {
                DetailsView1.ChangeMode(DetailsViewMode.Edit);

                int i=0;
                foreach (GridViewRow r in GridView1.Rows)
                {
                    if (r.RowType == DataControlRowType.DataRow)
                    {
                        ImageButton img = (ImageButton)GridView1.Rows[i].Cells[GridView1.Columns.Count - 1].FindControl("ImageButton2");
                        img.Visible = false;
                        i++;
                    }
                }

                DetailsView1.Focus();
            }

    Wednesday, January 7, 2009 9:17 AM