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

Grid on DocumentPane not filled

3 Answers 96 Views
GridView
This is a migrated thread and some comments may be shown as answers.
jpl
Top achievements
Rank 1
jpl asked on 23 Sep 2008, 03:26 PM
Hello,

I have an MDI App using a DockingManager. The DockingManager is in the main Form. Rather than using AutoDetectChildForms and create DocumentPanes automatically by MDIChild Forms additions to the main Form, I prefer using custom DocumentPanes that I add programmatically to the DockingManager (because the AutoDetectChildForms feature clears the main Form's MDIChildren collection, and its a pity).

It works well... But !... any RadGridView designed on a custom DocumentPane doesn't fill with datas and doesn't display anything. (Even with this simple sample, 
List<string> myList = new List<string>();
myList.Add(
"One");
myList.Add(
"Two");
myList.Add(
"Three");
radGridView1.DataSource = myList;
)

Of course, I checked that the program does execute the lines above, the DataSource is well defined but the grid doesn't display anything. If I put the grid on a simple form, it works, of course.

What's going wrong with that ?!

3 Answers, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 25 Sep 2008, 01:32 PM
Hello _,

We tried to reproduce this problem, but to no avail. Please send us a simple project that reproduce it so that we can test it locally. You can do so by opening a support ticket from your Client.net account.
 
Thank you in advance.
 

Sincerely yours,
Julian Benkov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
jpl
Top achievements
Rank 1
answered on 11 Oct 2008, 08:47 AM
Here is a simple project reproducing the behaviour. Run it and choose a name of new tab to display/hide. On each tab you'll see a RadGridView empty while a DataGridView is filled in the same context.

 
 
using System;  
using System.Collections.Generic;  
using System.Linq;  
using Telerik.WinControls.Docking;  
using System.ComponentModel;  
using System.Data;  
using System.Drawing;  
using System.Text;  
using System.Windows.Forms;  
using System.Reflection;   
 
namespace test{  
static class Program {  
[STAThread]  
static void Main(string[] args){  
Application.EnableVisualStyles();  
Application.SetCompatibleTextRenderingDefault(false);  
Application.Run(new TestForm());  
}   
   
 
public partial class TestForm : Form {  
public TestForm() {  
InitializeComponent();  
}  
void toggleDocument(Type type,string name,object[] args){  
if (type == nullreturn;  
try{  
Cursor = Cursors.WaitCursor;  
CustomPane childDocument=null;  
foreach (CustomPane document in dockingManager.Documents)  
if (document.Name == name){  
childDocument = document;  
break;  
}  
bool newChild = childDocument == null;  
childDocument = !newChild ? childDocument : (CustomPane)type.Assembly.CreateInstance(type.FullName, false, BindingFlags.Default, null, args, nullnull);  
if(newChild){  
childDocument.Name = name;  
childDocument.Text = name;  
}  
if (!newChild){  
childDocument.Dispose();  
dockingManager.RemoveDocument(childDocument);  
}  
else 
dockingManager.SetDocument(childDocument);  
}  
finally{  
Cursor = Cursors.Default;  
}  
}   
 
private void btnToggleDoc_Click(object sender, EventArgs e){  
toggleDocument(typeof(CustomPane), txbName.Text, null);   
}  
 
private System.ComponentModel.IContainer components = null;   
 
protected override void Dispose(bool disposing){  
if (disposing && (components != null))  
{  
components.Dispose();  
}  
base.Dispose(disposing);  
 
#region Windows Form Designer generated code  
private void InitializeComponent(){   
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TestForm));  
this.dockingManager = new Telerik.WinControls.Docking.DockingManager();  
this.btnToggleDoc = new System.Windows.Forms.Button();  
this.label = new System.Windows.Forms.Label();  
this.txbName = new System.Windows.Forms.TextBox();  
((System.ComponentModel.ISupportInitialize)(this.dockingManager)).BeginInit();  
this.dockingManager.SuspendLayout();  
this.SuspendLayout();  
this.dockingManager.ActiveDocument = null;  
this.dockingManager.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)| System.Windows.Forms.AnchorStyles.Left)| System.Windows.Forms.AnchorStyles.Right)));  
this.dockingManager.BorderStyle = System.Windows.Forms.BorderStyle.None;this.dockingManager.LayoutTree = resources.GetString("dockingManager.LayoutTree");  
this.dockingManager.Location = new System.Drawing.Point(-4, 0);  
this.dockingManager.Name = "dockingManager";  
this.dockingManager.PrimarySiteComponent.ActiveDocument = null;  
this.dockingManager.PrimarySiteComponent.Location = new System.Drawing.Point(0, 0);  
this.dockingManager.PrimarySiteComponent.Name = "PrimarySite";  
this.dockingManager.PrimarySiteComponent.PresenterMinSize = 25;  
this.dockingManager.PrimarySiteComponent.TabIndex = 0;  
this.dockingManager.Size = new System.Drawing.Size(288, 235);  
this.dockingManager.SizeWeight = 0.5;  
this.dockingManager.TabIndex = 3;  
 
this.btnToggleDoc.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));  
this.btnToggleDoc.Location = new System.Drawing.Point(209, 238);  
this.btnToggleDoc.Name = "btnToggleDoc";  
this.btnToggleDoc.Size = new System.Drawing.Size(75, 23);  
this.btnToggleDoc.TabIndex = 2;  
this.btnToggleDoc.Text = "Toggle";  
this.btnToggleDoc.UseVisualStyleBackColor = true;  
this.btnToggleDoc.Click += new System.EventHandler(this.btnToggleDoc_Click);  
 
this.label.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));  
this.label.AutoSize = true;  
this.label.Location = new System.Drawing.Point(44, 243);  
this.label.Name = "label";  
this.label.Size = new System.Drawing.Size(41, 13);  
this.label.TabIndex = 5;  
this.label.Text = "Name :";   
   
this.txbName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));  
this.txbName.Location = new System.Drawing.Point(103, 239);  
this.txbName.Name = "txbName";  
this.txbName.Size = new System.Drawing.Size(100, 20);  
this.txbName.TabIndex = 6;   
   
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);  
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;  
this.ClientSize = new System.Drawing.Size(284, 264);  
this.Controls.Add(this.txbName);  
this.Controls.Add(this.label);  
this.Controls.Add(this.btnToggleDoc);  
this.Controls.Add(this.dockingManager);  
this.Name = "TestForm";  
this.Text = "TestForm";  
((System.ComponentModel.ISupportInitialize)(this.dockingManager)).EndInit();  
this.dockingManager.ResumeLayout(false);  
this.ResumeLayout(false);  
this.PerformLayout();  
}
#endregion   
   
private Telerik.WinControls.Docking.DockingManager dockingManager;  
private System.Windows.Forms.Button btnToggleDoc;  
private System.Windows.Forms.Label label;  
private System.Windows.Forms.TextBox txbName;  
}  
 
class CustomPane : DocumentPane {  
public struct Item{  
public string Value { getset; }  
}   
   
public CustomPane(){  
InitializeComponent();  
Item[] dataSource=new Item[] { new Item {Value="ONE" }, new Item {Value= "TWO" }, new Item {Value= "THREE" }};  
dataGridView.DataSource =dataSource;  
radGridView.DataSource = dataSource;  
}  
 
private DataGridView dataGridView;  
private Telerik.WinControls.UI.RadGridView radGridView;  
 
private void InitializeComponent(){  
this.radGridView = new Telerik.WinControls.UI.RadGridView();  
this.dataGridView = new System.Windows.Forms.DataGridView();  
((System.ComponentModel.ISupportInitialize)(this.radGridView)).BeginInit();  
((System.ComponentModel.ISupportInitialize)(this.radGridView.MasterGridViewTemplate)).BeginInit();  
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();  
((System.ComponentModel.ISupportInitialize)(this)).BeginInit();  
this.SuspendLayout();  
 
this.radGridView.Dock = System.Windows.Forms.DockStyle.Top;  
this.radGridView.Location = new System.Drawing.Point(0, 0);  
this.radGridView.Name = "radGridView";  
this.radGridView.Size = new System.Drawing.Size(275, 120);  
this.radGridView.TabIndex = 0;   
 
this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)| System.Windows.Forms.AnchorStyles.Left)| System.Windows.Forms.AnchorStyles.Right)));   
   
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;  
this.dataGridView.Location = new System.Drawing.Point(0, 120);  
this.dataGridView.Name = "dataGridView";  
this.dataGridView.Size = new System.Drawing.Size(275, 150);  
this.dataGridView.TabIndex = 1;   
   
this.Controls.Add(this.dataGridView);  
this.Controls.Add(this.radGridView);  
this.Name = "CustomPane";  
this.PreferredDockSize = new System.Drawing.Size(275, 273);  
this.Size = new System.Drawing.Size(275, 273);((System.ComponentModel.ISupportInitialize)(this.radGridView.MasterGridViewTemplate)).EndInit();((System.ComponentModel.ISupportInitialize)(this.radGridView)).EndInit();((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();((System.ComponentModel.ISupportInitialize)(this)).EndInit();  
this.ResumeLayout(false);  
this.PerformLayout();  
}  
}  
}  
}  
0
Julian Benkov
Telerik team
answered on 14 Oct 2008, 03:59 PM
Hi _,

The problem is related to BindingContext of RadGridView. Currently you can bind or set the DataSource property of RadGridView after the host DocumentPane window is docked. The issue is already solved and the fix will be available for upcoming major Q3 release planed for next month.

Sorry for the inconvenience. Your Telerik points have been updated.


Kind regards,
Julian Benkov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
jpl
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
jpl
Top achievements
Rank 1
Share this question
or