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

GridView to be expanded with user control

6 Answers 126 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ajay
Top achievements
Rank 1
Ajay asked on 21 May 2010, 10:35 AM
hello ,

   I need to achieve the functionality in a GridView to be expanded with user Control as show in the attached images.
In image 1 : CollapseGrid (normal display)
    image 2 : ExpandGrid (Expended with UserControl)

Please do needfull ASAP.

thank you,

Regards,

Ajay

6 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 21 May 2010, 02:14 PM
Hi Ajay,

Please check the row details and tabbed child views examples in our demo application. They demonstrate how to present detailed information in a child view. You can add a custom control in the child view by using RadHostItem. However, this case is not fully supported and may cause visual glitches when scrolling. RadGridView uses visual elements to present everything and user control hosted inside can't be clipped. I will suggest using rad elements instead. If you have further questions, please review the provided documentation.


Kind regards,

Jack
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ajay
Top achievements
Rank 1
answered on 24 May 2010, 06:39 AM
Hello Jack,

 Thanks for your prompt reply. But this solution is not much helpful. 
If you provide a demo application than it would be very helpful.

Please do needful ASAP.
Thanks ,

Regards
Ajay.
0
Jack
Telerik team
answered on 27 May 2010, 07:16 AM
Hello Ajay,

I understand. Like I said we do not fully support this scenario. It may cause visual glitches and slow down your application. Maybe a better choice is to show a dialog. We will consider making the process of implementing this scenario easier.

Nevertheless, you can use the "row details" example from our demo application as a base. Just replace the DetailsColumn with a custom one which hosts a user control. In this example I use a button:

void radGridView1_CreateCell(object sender, GridViewCreateCellEventArgs e)
{
    if (e.Row is GridDataRowElement && e.Column == this.radGridView1.DetailsColumn)
    {
        e.CellType = typeof(CustomDetailsCell);
    }
}
 
public class CustomDetailsCell : GridDataCellElement
{
    Button button;
 
    public CustomDetailsCell(GridViewColumn column, GridRowElement row)
        : base(column, row)
    {
    }
 
    protected override void DisposeManagedResources()
    {
        base.DisposeManagedResources();
        if (button != null)
        {
            button.Dispose();
        }
    }
 
    protected override void CreateChildElements()
    {
        button = new Button();
        RadHostItem hostItem = new RadHostItem(button);
        this.Children.Add(hostItem);
    }
 
    protected override void SetContentCore(object value)
    {
        if (value != null)
        {
            button.Text = value.ToString();
        }
        else
        {
            button.Text = string.Empty;
        }
    }
}

I hope this helps. Should you have any questions, do not hesitate to contact me.

All the best,
Jack
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jorge Mendoza Martinez
Top achievements
Rank 1
answered on 13 Aug 2010, 01:15 PM
Hi! I am trying to use a Row Detail, like the example code, but I can't find the property DetailColumn on the RadGridView control, I am using the version Q1 2010 SP1, Winforms
0
Neha
Top achievements
Rank 1
answered on 16 Aug 2010, 10:52 AM
Hi,

I have not fully understand your question.
But try using GridView link, go through the example ,it may help you.

Regards

TotalDotNet
0
Julian Benkov
Telerik team
answered on 18 Aug 2010, 05:48 PM
Hello Neha,

Thanks for writing.

The DetailColumn is just a sample column for the concrete code snippet. You can replace it with any column that will be used to host controls in your scenario.

Kind regards,
Julian Benkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Ajay
Top achievements
Rank 1
Answers by
Jack
Telerik team
Ajay
Top achievements
Rank 1
Jorge Mendoza Martinez
Top achievements
Rank 1
Neha
Top achievements
Rank 1
Julian Benkov
Telerik team
Share this question
or