DataGrid Focus

Discussion in 'ASP .Net' started by ABHIJIT B, Feb 18, 2008.

  1. ABHIJIT B

    ABHIJIT B Guest

    Hi,

    We are using ASP.net 2.0 with C# for developing web application.
    I am using datagrid in one of form and binding data to it as given
    below,

    if (dsDatabaseList.Tables[0].Rows.Count > 0)
    {
    dgServiceDatabaseList.DataSource =
    dsDatabaseList.Tables[0];
    dgServiceDatabaseList.DataBind();
    //dgServiceDatabaseList.SelectedIndex =
    0;
    dgServiceDatabaseList.Items[0].Cells[0].Focus();
    dgServiceDatabaseList.Cur =
    dcDatabaseListSucess = true;
    }

    dsDatabaseList.Tables[0] contains more than 100 records.

    I want to set focus on first row and first column in datagrid.

    I tried using foloowing,

    dgServiceDatabaseList.SelectedIndex = 0; but this highlights the row
    but iw ant to set focus.

    I am unaware of SetFocus() method.

    Best Regards,
    Abhijit B
     
    ABHIJIT B, Feb 18, 2008
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.