You must Sign In to post a response.
  • Category: ASP.NET

    Show GridView Last Row

    Hi,
    I have a gridview which is inside a panel of fixed size and vertical scrolling is on. On button click I am filling the data from database and if data is huge vertical scroll bar is visible.
    Now I want to set the focus on the last row of the gridview as depending on the values of last row next insert will take place..

    with regards,
    Binay Kumar Prasad.
  • #768039
    Hi Binay,

    Currently there are many Third party datagrid are came up in the market which has all the facilities with it.
    Hope you are using a default Datagrid without any third party dll.

    I understand from your question is like you want to keep the current cursor position in the last row of the every page in datagrid?


    dv_Checks.CurrentCell = dv_Checks.Rows[dvcount - 1].Cells[0]; // If it is first column


    If you look for some other thing. Kindly post the screenshot and explain.

    Thanks,
    Mani

  • #768049
    hi
    I will send one simple code to you. this code may be helpful to you. please try this code .

    protected void grid_PreRender(object sender, EventArgs e)
    {
    GridViewRow row = grdAlert.Rows[grdAlert.Rows.Count - 1];

    // do stuff with your row
    }

    thank you

  • #768053
    Hey prasad,

    i understand what you went to say this.

    I sent you some code for your quirie to focus on raw editing in gridview so try it.

    Follow Code:

    //currentIndex is the index of grid row
    var rowElement = this.getView().getRecord(currentIndex);
    this.getView().focusRow(rowElement);

    This one also preffered:

    DataGridViewRow rowToSelect = this.dgvJobList.CurrentRow;

    rowToSelect.Selected = true;



    rowToSelect.Cells[0].Selected = true;

    this.dgvJobList.CurrentCell = rowToSelect.Cells[0];

    this.dgvJobList.BeginEdit(true);

    Hope it helps,

    Thanks,
    Vaibhav Shah


Sign In to post your comments