
If anyone has any interested in this information let me know and I will gladly adapt some examples to post--with Telerik's permission, of course ;-)
9 Answers, 1 is accepted


Not a problem, I am still finishing up some of the work, but I will post some examples as soon as I can. In the meantime if you have any questions I would be glad to help out.
- Larkin

Just curious, do you drop all of your dlls in the GAC for your webserver or have you been successful in adding them to the bin folder and doing custom security?
I plan to create a web part that pull sales data from my sql server and displays the data and a pie chart for the top ten customers. I plan to use the Rad chart control, but as I would normally drop the chart on an aspx page in VS.net, I am a little unclear on what I need to do for a web part to use the control. So any examples you have of using the controls in a webpart would be appreciated.
Also do you need to add teh Radcontrol (radchart) dll to the savecontrol section of the web.config? I am getting an "cannot be displayed or imported because it is not registered on this site as safe." for my webpart even though my dll is registered in my web.config and I dropped my dll in the GAC. So I am wondering if any of the assemblies referenced need to be included in the safecontrols.
Thanks in advance for your help.

The "TopTenChart" Web Part appears to be causing a problem. "
error page.
<code>
Imports System
Imports System.ComponentModel
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Xml.Serialization
Imports System.Drawing
Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.Utilities
Imports Microsoft.SharePoint.WebPartPages
Imports Telerik.WebControls
Imports Microsoft.ApplicationBlocks.Data
<DefaultProperty("Text"), ToolboxData("<{0}:TopTenChart runat=server></{0}:TopTenChart>"), XmlRoot(Namespace:="SalesDataWPLibrary")> _
Public Class TopTenChart
Inherits Microsoft.SharePoint.WebPartPages.WebPart
' Private Shared colors As Color() = {Color.AliceBlue, Color.AntiqueWhite, Color.Aqua, Color.Aquamarine, Color.Azure, Color.CornflowerBlue, Color.SteelBlue}
Dim chart1 As Telerik.WebControls.RadChart
Dim s, s1 As ChartSeries
Private Const _defaultText As String = "TopTen"
Dim _text As String = _defaultText
<Browsable(True), Category("Miscellaneous"), DefaultValue(_defaultText), WebPartStorage(Storage.Personal), FriendlyName("Text"), Description("Text Property")> _
Property [Text]() As String
Get
Return _text
End Get
Set(ByVal Value As String)
_text = Value
End Set
End Property
'Render this Web Part to the output parameter specified.
Protected Overrides Sub CreateChildControls()
chart1 = New RadChart
chart1.ChartSeriesCollection.Clear()
s = New ChartSeries("GDP", Color.Red, ChartSeriesType.Line)
s.ShowLabels = True
s.AddItem(1)
s.AddItem(1.5)
s.AddItem(2.0)
s.AddItem(2.5)
s.AddItem(3.5)
chart1.AddChartSeries(s)
s1 = New ChartSeries("GNP", Color.Blue, ChartSeriesType.Line)
s1.ShowLabels = True
s1.AddItem(2)
s1.AddItem(3)
s1.AddItem(3.5)
s1.AddItem(4)
s1.AddItem(4.5)
chart1.AddChartSeries(s1)
chart1.Title1.Text = "Growth Indicators"
chart1.Title1.TextColor = Color.BlueViolet
chart1.XAxis.Label.Text = "Years"
chart1.XAxis.AxisColor = Color.Yellow
chart1.XAxis.Label.TextColor = Color.Brown
chart1.XAxis.AxisWidth = 2
chart1.YAxis.Visible = True
chart1.YAxis.Label.Text = "%"
chart1.YAxis.AxisColor = Color.Yellow
chart1.YAxis.Label.TextColor = Color.Brown
chart1.YAxis.AxisWidth = 2
Controls.Add(chart1)
End Sub
Protected Overrides Sub RenderWebPart(ByVal output As System.Web.UI.HtmlTextWriter)
RenderChildren(output)
output.Write(SPEncode.HtmlEncode([Text]))
'chart1.RenderControl(output)
End Sub
End Class
</code>


I am no longer getting the "cannot be displayed or imported because it is not registered on this site as safe.", but I am now getting the more general "Web Part appears to be causing a problem." error. If I comment out the Controls.Add(chart1) My webpart renders without error, so I believe my control is listed as safe and my dwp is correct, but something is wrong with how I am using the chart control.
Any help would be appreciated.
Hi Frederick,
You may try the following:
- Copy RadControls folder in C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\LAYOUTS\. Then set the RadControlsDir property of r.a.d.chart to "~/_layouts/RadControls".
- Set the UseSession property of r.a.d.chart to false because session state is disabled by default in SharePoint.
- Make a "temp" folder in c:\inetpub\wwwroot. It is required by r.a.d.chart when session state is disabled.
- Make sure you are instantiating r.a.d.chart and adding it in the Controls collection in CreateChildControls not in RenderWebPart.
You can enable exception stacktrace in SharePoint to see verbose output of the error you are getting. Here is explained how.
Kind Regards,
Robert
the telerik team

I would be very interested to see how you got the RAD Menu to work. I have gotten the control to the point where I can get the top level menu to render but when you mouse over items in the top menu, a sub-menu does not drop down as you would expect.
The relevant code:
protected override void RenderWebPart(HtmlTextWriter output)
{
EnsureChildControls();
RadMenu1.LoadContentFileAbsolutePath(Page.Server.MapPath(".\\menu.xml"));
RadMenu1.RenderControl(output);
output.Write(SPEncode.HtmlEncode(Text));
}
protected override void CreateChildControls()
{
base.CreateChildControls ();
RadMenu1 = new Telerik.WebControls.RadMenu();
Controls.Add(RadMenu1);
}
Hi Christopher,
We've replied your support ticket but are pasting our reply here also:
The problem in your case is that you are populating the menu in the RenderWebPart method which is too late considering it's lifecycle. You should move the call of RadMenu1.LoadContentFileAbsolutePath(Page.Server.MapPath(".\\menu.xml")); into your CreateChildControls method. Here is a code snippet which we typically send to clients who are trying to implement a SharePoint WebPart - the population code goes in CreateChildControls.
public class MyWebPart : WebPart
{
protected override void CreateChildControls()
{
base.CreateChildControls();
RadMenu menu = new RadMenu();
menu.ID = "myMenu";
/* populate your menu based on your requirements */
menu.LoadContentFileAbsolutePath(Page.Server.MapPath(".\\menu.xml"));
Controls.Add(menu);
}
protected override void RenderWebPart(HtmlTextWriter output)
{
EnsureChildControls();
RenderChildren(output);
}
}
Regards,
Albert
the telerik team