Greetings,
I have a strange situation. I have a Sharepoint web part which works wonderfully using the Telerik RadGrid to display data. I now want to create an similar webpart with Ajax functionality. My first thought was to build this second part like this (code paraphrased):
[C#]
I would rather not manage the same code in two places. It seems that what I'm trying to do in the first example should work just fine. Is there some subtlety in the RadGrid that stops it from being displayed when it is moved from one ControlCollection to another?
.NET 3.0, Sharepoint 2007
I have a strange situation. I have a Sharepoint web part which works wonderfully using the Telerik RadGrid to display data. I now want to create an similar webpart with Ajax functionality. My first thought was to build this second part like this (code paraphrased):
[C#]
public class AjaxMetricGridWebPart : MetricGridWebPartWhen I do this, the grid does not display in the new web part. However, copying the code from the MetricGridWebPart class into the AjaxMetricGridWebPart class and simply modifying the CreateChildControls() method works great.
{
public override CreateChildControls()
{
// Allow the parent class to do its work
base.CreateChildControls();
// Find the grid in the control collection and remove it
Control rg;
foreach (Control c in this.Controls)
{
if (c is RadGrid)
{
rg = c;
break;
}
}
this.Controls.Remove(rg);
// Create an ASP.NET UpdatePanel
UpdatePanel up = new UpdatePanel();
up.ContentTemplateContainer.Controls.Add(rg);
this.Controls.Add(up);
}
}
I would rather not manage the same code in two places. It seems that what I'm trying to do in the first example should work just fine. Is there some subtlety in the RadGrid that stops it from being displayed when it is moved from one ControlCollection to another?
.NET 3.0, Sharepoint 2007