Adi
Adi

Reputation: 5223

AspxGridView initially load empty

I asked this question here, too: http://www.devexpress.com/Support/Center/p/Q388764.aspx but I hope for a quicker answer here.

I need my grid to display data only after the user starts filtering.

This is the scenario:

  1. When opening a page containing the grid, the grid should no even try to display the data.

  2. When the user starts searching (applies a filter), the data should be displayed.

Is this possible? Thanks.

Upvotes: 1

Views: 5634

Answers (3)

Niranjan Singh
Niranjan Singh

Reputation: 18290

Ref: this
Subscribing to DataBinding event resolved all troubles with correct behavior actions like sorting, filtering and groupping events of ASPxGridView in runtime mode with requirement of getting DataTable for ASPxGridView.DataSource.

And you have answered at devexpress also it was also using the idea to implement this as i have looked by above reference link:

 protected void gvData_DataBinding(object sender, EventArgs e) {
        if (Convert.ToBoolean(Session["need_bind"]))
            gvData.DataSource = DSource;
        else
            gvData.DataSource = null;
    }

along this use ASPxGridView.ProcessColumnAutoFilter event handler

Upvotes: 1

Kuffs
Kuffs

Reputation: 35661

Make the grid default to a filter that returns no records. The end user can then filter\search themselves and the ajax callbacks will repopulate the grid.

Upvotes: 0

Tanveer-Ibn- Haresh
Tanveer-Ibn- Haresh

Reputation: 300

Do not bind the data in the Page_load.

Bind the grid to the datasource in the filter event/ search button click event..

Upvotes: 1

Related Questions