PDA

View Full Version : [CLOSED] Error Creating control - chart modelfield



megatechboy
Jun 19, 2014, 2:40 PM
I've got a simple chart bound to a store which gets its data from stored procedure. This part works fine. Error shows in design view ' Error Creating Control - Panel1' --- compiled and running project shows no error on webpage.

Cannot create an object type of 'system.string[]' from its string representation 'PROJNUM' for the 'Field' property. -- PROJNUM field is a varchar field in db.

Using ext.net 2.5.5.10697, ext.net.utilities 2.4.0.0 & Newtonsoft.json 6.0.3 (however, VS shows Newtonsoft.json with a version of 6.0.0.0 in project properties references window -- it is pointing to the correct dll though).



<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="facCharts.ascx.vb" Inherits="MSEFUSION.facCharts" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>


<ext:Panel ID="Panel1" runat="server" Height="300" Title="Title">
<Items>

<ext:Chart ID="Chart1" runat="server" Animate="true" Width="330" Height="300" Shadow="true" InsetPadding="30" Theme="Base:gradients">
<LegendConfig Position="Right" />
<HtmlBin>
<asp:SqlDataSource ID="SQLDS1" runat="server" ConnectionString="<%$ ConnectionStrings:MSE_FIN %>" SelectCommand="PROC_LIST_PRJ_LARGEBUD_BYPI" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:Parameter Name="PID" Type="Int32" DefaultValue="1016" />
</SelectParameters>
</asp:SqlDataSource>
</HtmlBin>
<Store>
<ext:Store ID="Store1" runat="server" DataSourceID="SQLDS1" AutoDataBind="True" >
<Model>
<ext:Model ID="Model1" runat="server" >
<Fields>
<ext:ModelField Name="PROJNUM" />
<ext:ModelField Name="DBAL" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<Series>
<ext:PieSeries AngleField="DBAL" ShowInLegend="false" Donut="0" Highlight="true" HighlightSegmentMargin="20">
<Label Display="Rotate" Contrast="true" Font="12px Arial" Field="PROJNUM" />
</ext:PieSeries>
</Series>
</ext:Chart>

</Items>
</ext:Panel>

Daniil
Jun 19, 2014, 4:42 PM
Hi @megatechboy,

I removed the SqlDataSource and added this instead:

protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
this.Store1.DataSource = new object[]
{
new
{
PROJNUM = "PROJNUM 1",
DBAL = 100
}
};
}
}
and your control runs well for me. No error and the Chart appears.

Please post a screenshot of the Exception.

Ideally, please provide a runnable test case to reproduce. No depends on a database, please. It should not require it.

megatechboy
Jun 19, 2014, 5:05 PM
Thanks Daniil, attached is a screenshot. I tried it with your changes, and it run, a chart was displayed, but the error is still there, in the design view of VS editor.

I think it might be a problem with VS and the versions of references i have installed.

Daniil
Jun 19, 2014, 8:52 PM
Here is a quote from
http://forums.ext.net/showthread.php?18820&p=81437&viewfull=1#post81437


Currently Ext.NET provides only limited Visual Studion Design Time support.

I am afraid it is still actual.