How to force RowSourceNeeded

3 posts, 1 answers
  1. Chris Kirkman
    Chris Kirkman avatar
    101 posts
    Member since:
    Apr 2010

    Posted 01 Feb 2018 Link to this post

    I have a GridView with many rows (let's call it Grid A).  Within each row there is another GridView (Grid B).  This is created when the RowSourceNeeded event is raised. 

    When the user changes a value in one of the columns in my GridView (Grid A), I need this to result in removing the GridView (Grid B) that was added during RowSourceNeeded and have the event be raised again.

  2. Chris Kirkman
    Chris Kirkman avatar
    101 posts
    Member since:
    Apr 2010

    Posted 01 Feb 2018 Link to this post

    Looks like this will work.  In the CellEndEdit event I can access my model, reload the values that I'll need after the change and then assign those values to the existing rows in the hierarchical child grid.


    Interesting tidbit though.  If I don't set the IsExpanded to false and then true the changes are not reflected in the UI.  Almost seems like this is a refresh issue of some sort.


    private async void BatchComparisonGridCellEndEdit(object sender, GridViewCellEventArgs e)
        // get the selected id and reload the gamma for this reference scan
        ComparisonScanViewModel model = BatchComparisonGrid.CurrentRow.DataBoundItem as ComparisonScanViewModel;
        // tell user finding gamma
        UpdateWaitingBar(ElementVisibility.Visible, "Calculating Passing Percentage...");
        // calculate gamma
        if (null != model)
            await model.FindGamma(Convert.ToInt32(e.Value));
        if (null != BatchComparisonGrid.CurrentRow.ViewTemplate.ChildRows &&
            0 != BatchComparisonGrid.CurrentRow.ViewTemplate.ChildRows.Count)
            // refresh the row details table (which shows the analysis parameters)
            foreach (GridViewRowInfo row in BatchComparisonGrid.CurrentRow.ViewTemplate.ChildRows[0].ChildRows)
                // update each row
                row.Cells[PARAMETER_ROW_VALUE].Value =
                    model.Parameters.FirstOrDefault(p =>
                    p.Title == (string)row.Cells[PARAMETER_ROW_DESCRIPTION].Value).Value;
            BatchComparisonGrid.CurrentRow.IsExpanded = false;
            BatchComparisonGrid.CurrentRow.IsExpanded = true;
        // refresh in the UI
        // tell user done
  3. Answer
    Dimitar avatar
    2951 posts

    Posted 02 Feb 2018 Link to this post

    Hello Chris,

    Yes, collapsing/expanding will trigger the event. Here is another approach:
    var row = ((GridViewHierarchyRowInfo)radGridView1.CurrentRow);

    Should you have any other questions do not hesitate to ask.

    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top