Skip to main content
Tab

ASPxGridView.MakeRowVisible(Object) Method

Makes the specified data row visible on screen.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public bool MakeRowVisible(
    object keyValue
)

Parameters

Name Type Description
keyValue Object

An object that identifies the data row by its key value.

Returns

Type Description
Boolean

true, if the specified data row has been made visible on screen; otherwise, false.

Remarks

If page-mode navigation is enabled, use the MakeRowVisible method to switch to the page which displays the specified data row (if required). If the row is not found, the MakeRowVisible method does nothing and returns false.

Note

The MakeRowVisible method is not in effect if the endless paging mode is enabled.

Example

This example demonstrates how you can respond to insertion of a new master row into the grid to allow an end-user to enter the corresponding details immediately.In this sample, the ASPxGridView is used in master-detail mode. Grid detail rows are represented by an ASPxPageControl, which is placed within the grid's DetailRow template.

The ASPxPageControl has two tab pages, which contain different UserControls.

The first tab page has an ASPxMemo editor displaying master row description info. The second tab page's content is represented by another ASPxGridView control that maintains master row details.

By default, the first tab page is active.After an end-user inserts a new master row into the master grid, it is required to focus this row, open its detail row, make the ASPxPageControl's second tab page active and switch the detail grid to the insert mode.This behavior is implemented by handling the master ASPxGridView's RowInserting event and the ASPxPageControl's DataBound event.

using System;
using DevExpress.Web;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e) {

    }

    protected void GridView_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e){
        ASPxGridView gridView = (ASPxGridView)sender;

        GridDataSource gridDataSource = new GridDataSource();
        gridDataSource.InsertRow(e.NewValues, gridView.SettingsDetail.IsDetailGrid);

        gridView.CancelEdit();
        e.Cancel = true;

        //Navigate to the newly inserted row within the grid and open its details
        gridView.MakeRowVisible(e.NewValues["ID"]);
        gridView.DetailRows.ExpandRowByKey(e.NewValues["ID"]);

        activeTabIndex = 1;
    }

    private int? activeTabIndex;

    protected void ASPxPageControl1_DataBound(object sender, EventArgs e){
        if (activeTabIndex.HasValue){
            //Change the ASPxPageControl's active tab page, and switch the detail grid to insert mode
            ASPxPageControl pageControl = sender as ASPxPageControl;
            pageControl.ActiveTabIndex = activeTabIndex.Value;
            ASPxGridView detailGrid = pageControl.FindControl("WebUserControl2").FindControl("gvDetail") as ASPxGridView;
            detailGrid.AddNewRow();
        }
    }
}
See Also