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

child grid search? + multi column sorting?

4 Answers 171 Views
GridView
This is a migrated thread and some comments may be shown as answers.
hosein
Top achievements
Rank 1
hosein asked on 30 Jan 2011, 10:22 AM

Hi

I have radControls for winforms 2010 Q3

I tried "Custom Filtering" codes in demo and it works fine

But I want to search the child templates (child grids) too.

How can I do that?

thanks

4 Answers, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 02 Feb 2011, 04:43 PM
Hello Hosein,

Thank you for your question.

The mechanism for implementing custom filtering for the master and the child templates of RadGridView is the same. All you should do is enable the filtering and custom filtering of the concrete template, add FilterDescriptor to it and subscribe to the CustomFiltering event of RadGridView:
this.radGridView1.Templates[0].EnableFiltering = true;
this.radGridView1.Templates[0].EnableCustomFiltering = true;
this.radGridView1.CustomFiltering += new GridViewCustomFilteringEventHandler(radGridView1_CustomFiltering);
 
this.radGridView1.Templates[0].FilterDescriptors.Add(new FilterDescriptor());
 
private void radGridView1_CustomFiltering(object sender, GridViewCustomFilteringEventArgs e)
{
}

I hope it helps.

Best regards,
Alexander
the Telerik team
Q3’10 SP1 of RadControls for WinForms is available for download; also available is the Q1'11 Roadmap for Telerik Windows Forms controls.
0
hosein
Top achievements
Rank 1
answered on 02 Feb 2011, 06:31 PM

Hello

Thanks a lot for answer (I was waiting about three days for any help)

I wrote these codes in radGridView1_CustomFiltering(object sender, GridViewCustomFilteringEventArgs e)

if (string.IsNullOrEmpty(txtSearch.Text))
            {
                e.Visible = true;
                for (int i = 0; i < radGridView1.ColumnCount; i++)
                {
                    e.Row.Cells[i].Style.Reset();
                    e.Row.InvalidateRow();
                }
                return;
            }
            e.Visible = false;
            for (int i = 0; i < this.radGridView1.ColumnCount; i++)
            {
                string text = e.Row.Cells[i].Value.ToString();
                if (text.IndexOf(txtSearch.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0)
                {
                    e.Visible = true;
                    e.Row.Cells[i].Style.CustomizeFill = true;
                    e.Row.Cells[i].Style.DrawFill = true;
                    e.Row.Cells[i].Style.BackColor = Color.FromArgb(201, 252, 254);
                }
                else
                {
                    e.Row.Cells[i].Style.Reset();
                    e.Row.InvalidateRow();
                }
            }
I also add These two lines to the code:

this.radGridView1.Templates[0].EnableFiltering = true;
this.radGridView1.Templates[0].EnableCustomFiltering = true;

But it does not search the child templates.

How can I change the code to search the child templates too?

Thanks

0
Richard Slade
Top achievements
Rank 2
answered on 02 Feb 2011, 10:29 PM
Hello,

In order to get to the child template, you can itterate over the rows, and inside that loop, itterate over the child rows.

Please see my answer in this forum post regarding getting to the child rows.
Hope that helps
Richard
0
Nikolay
Telerik team
answered on 04 Feb 2011, 02:13 PM
Hello hosein,

Thank you for writing back.

In regards to the response time, please note that we do support our users within 72 hours (Mon-Fri) for forum threads and within 24-48-72 hours for support tickets (depending on the license that you have). We may provide you with a quicker response, but this depends on the work load that we currently have. If you require a guaranteed quicker response, please consider purchasing one of the licenses that we offer.

Please let us know if you need additional assistance after referring to this forum thread. We will be glad to help you futher.

Kind regards,
Nikolay
the Telerik team
Q3’10 SP1 of RadControls for WinForms is available for download; also available is the Q1'11 Roadmap for Telerik Windows Forms controls.
Tags
GridView
Asked by
hosein
Top achievements
Rank 1
Answers by
Alexander
Telerik team
hosein
Top achievements
Rank 1
Richard Slade
Top achievements
Rank 2
Nikolay
Telerik team
Share this question
or