How to setting focus on a AxGridView column

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • John Osseyi
    New Member
    • Nov 2011
    • 1

    How to setting focus on a AxGridView column

    While inserting a row in a AxGridView, i'd want to set focus on a specific column in the grid. Can you help me do this please?
    Thanks a lot.
  • Palyadav
    New Member
    • Dec 2011
    • 23

    #2
    columnname.focu s();

    it will work

    You might want to handle the OnRowDataBound event from the GridView:
    Code:
    protected void _grid_RowDataBound(object sender, GridViewRowEventArgs e)
    {
    if (e.Row.RowType == DataControlRowType.DataRow && (e.Row.RowState
    & DataControlRowState.Edit) != 0)
    {
    Control c = e.Row.Cells[2].Controls[0];
    this.SetFocus(c);
    }
    }
    The trick is to know which column in e.Row.Cells and then which control in
    that Cell's Controls collectiono to set focus on.

    Comment

    Working...