Reputation: 3103
RadDock radDock1 = new RadDock();
radDock1.Dock = DockStyle.Fill;
this.Controls.Add(radDock1);
ToolWindow window1 = new ToolWindow();
window1.Name = "window1";
radDock1.DockWindow(window1, DockPosition.Left);
DocumentWindow document1 = new DocumentWindow();
document1.Name = "document1";
radDock1.AddDocument(document1);
I am using RadControls for WinForms, u can find in the provided link: http://www.telerik.com/help/winforms/overview.html
In document1 , I want to dynamically add my DataGridView that is default provided by VS2010. How can I do this.
Upvotes: 0
Views: 230
Reputation: 5732
To add a grid all you need is this:
DataGridView dataGridView1 = new DataGridView();
document1.Controls.Add(dataGridView1);
However, the grid will be empty. To fill it, just set the DataSource property.
DataGridView dataGridView1 = new DataGridView();
List<Colors> colors = new List<Colors>();
colors.Add(new Colors("Red"));
colors.Add(new Colors("Green"));
colors.Add(new Colors("Blue"));
colors.Add(new Colors("Yellow"));
colors.Add(new Colors("Pink"));
dataGridView1.DataSource = colors;
document1.Controls.Add(dataGridView1);
This is using a simple class Colors.
public class Colors
{
public Colors(string color)
{
Color = color;
}
public string Color { get; set; }
}
It should produce a form that looks like this:
Upvotes: 1