This is a migrated thread and some comments may be shown as answers.

PageViewElement IsSelected

1 Answer 45 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ebrahim
Top achievements
Rank 1
Ebrahim asked on 22 Dec 2011, 07:44 AM
Hi,

I have the list of data on grid view with template fields.
I want to select the child rows if count is not equal to 0.
Whenever i populate the data, those child rows with count is 0 will be Hidden and IsSelected = false.
And those child rows with count is not 0 will be Visible and IsSelected = true.
My problem is the first child row to select is selected forever and unable to click.

private void raddgvHistory_ViewCellFormatting(object sender, CellFormattingEventArgs e)
    {
      GridDetailViewCellElement cell = e.CellElement as GridDetailViewCellElement;
      if (cell != null)
      {
        if (cell.PageViewElement != null)
        {
          bool IsSelected = false;
 
          for (int iRow = 0; iRow < cell.PageViewElement.Items.Count; iRow++)
          {
            GridViewInfo viewInfo = cell.PageViewElement.Items[iRow].Tag as GridViewInfo;
            if (viewInfo.ChildRows.Count == 0)
            {
              cell.PageViewElement.Items[iRow].IsSelected = false;
              cell.PageViewElement.Items[iRow].Visibility = ElementVisibility.Hidden;
            }
            else
            {
              if (!IsSelected)
                IsSelected = cell.PageViewElement.Items[iRow].IsSelected = true;
 
              cell.PageViewElement.Items[iRow].Visibility = ElementVisibility.Visible;
            }
          }
        }
      }
 
    }

Correct me if there are some problem with my code.
Currently using Q2

1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 23 Dec 2011, 11:33 AM
Hi Ebrahim,

I tested the described scenario and I was not able to reproduce an issue, as far as I am able to understand it according from your description. Could you please send me your project and the exact steps to reproduce the issue? This will help me to understand it and to provide you with the best possible solution. Thank you for your understanding.

I am looking forward to your reply.
 
All the best,
Jack
the Telerik team

Q3’11
of RadControls for WinForms is available for download (see what's new). Get it today.
Tags
GridView
Asked by
Ebrahim
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or