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

RowIsExpandedChanged event in radgridview

2 Answers 120 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Koti
Top achievements
Rank 1
Koti asked on 24 Jul 2012, 09:38 AM
Hi
I have hierarchial radgridview.
gridview have childgridview. In child gridview has subchild gridview.
In sub child gridview has another child.
Like parent ->child ->sub child -> sub subchild
when expanding parent, child gridview poplating ,
when expanding child, sub child gridview poplating. 
when expanding sub child gridview, sub subchild gridview poplating. 

My problem is 
when expanding the child, it's RowIsExpandedChanged is firing and also it's parent gridview RowIsExpandedChanged is firing,

when expanding the sub child, it's RowIsExpandedChanged is firing and also child gridview's RowIsExpandedChanged is firing and parent gridview RowIsExpandedChanged is firing,
 

when expanding the sub subchild, it's RowIsExpandedChanged is firing and also sub child gridview's RowIsExpanded is firing and also child gridview's RowIsExpandedChanged is firing and parent gridview RowIsExpandedChanged is firing,
  

 How to restrict child grid's parent RowIsExpandedChanged event firing ? 

2 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 24 Jul 2012, 12:55 PM
Hello,

As there is no way to control wether and how the event is fired , I would recommend to check the sender or the original source of the event in your event handler thus filtering only the relevant instances of RadGridView and taking actions only for them .

All the best,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Koti
Top achievements
Rank 1
answered on 24 Jul 2012, 01:42 PM
Hi,
The following is the parent gridview and child gridviews's events
//Parent Gridview
    private void radProductivityGrid_RowIsExpandedChanged(object sender, RowEventArgs e)
        {
                var row = e.Row as Telerik.Windows.Controls.GridView.GridViewRow;
                var id = row.Cells[0] as Telerik.Windows.Controls.GridView.GridViewCell;
                var ws = row.Cells[5] as Telerik.Windows.Controls.GridView.GridViewCell;
                int cid = Convert.ToInt32(id.Value);
                string workstatus = ws.Value.ToString();
                if (workstatus == "")
                    workstatus = cbWorkStatus.Text.ToString();
                PopulateAccountDetails(cid, workstatus);           
        }
  
    //Child Gridview
       private void radProductivityAccount_RowIsExpandedChanged(object sender, RowEventArgs e)
        {
                var row = e.Row as Telerik.Windows.Controls.GridView.GridViewRow;
                var id = row.Cells[0] as Telerik.Windows.Controls.GridView.GridViewCell;
                var ws = row.Cells[5] as Telerik.Windows.Controls.GridView.GridViewCell;
                int acid = Convert.ToInt32(id.Value);
                string workstatus = ws.Value.ToString();
                if (workstatus == "")
                    workstatus = cbWorkStatus.Text.ToString();
                PopulateProviderDetails(acid, workstatus);
        }
      
    //Sub Child Gridview
    private void radProductivityProvider_RowIsExpandedChanged(object sender, RowEventArgs e)
        {
            var row = e.Row as Telerik.Windows.Controls.GridView.GridViewRow;
            var id = row.Cells[0] as Telerik.Windows.Controls.GridView.GridViewCell;
            var ws = row.Cells[5] as Telerik.Windows.Controls.GridView.GridViewCell;
            int pid = Convert.ToInt32(id.Value);
            string workstatus = ws.Value.ToString();
            PopulateUserDetails(pid, workstatus);
        }

Tags
GridView
Asked by
Koti
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Koti
Top achievements
Rank 1
Share this question
or