Skip to content

DevExpress-Examples/asp-net-web-forms-grid-lookup-change-the-displayed-text-when-all-rows-are-selected

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GridLookup for ASP.NET Web Forms - How to display a custom text when all rows are selected

This example illustrates how to display a custom text inside ASPxGridLookup when all its rows are selected.

Custom Select All Text

To implement this scenario, follow the steps below:

  1. Handle the ASPxGridLookup.ValueChanged event to pass a flag to the client. The flag indicates whether all rows are selected.

    protected void gridLookup_ValueChanged(object sender, EventArgs e)
    {
        ASPxGridLookup gl = sender as ASPxGridLookup;
        if (gl.GridView.Selection.Count == gl.GridView.VisibleRowCount)
            gl.GridView.JSProperties["cp_selected"] = true;
    }
  2. On the client, handle the ASPxClientGridLookup.EndCallback event and specify a custom text if the flag returns true.

    function OnEndCallback(s, e) {
        if (s.GetGridView().cp_selected) {
            s.GetInputElement().value = "(Select All)";
            delete (s.GetGridView().cp_selected);
        }
    }

Files to Review