Page 1 of 1
Webchart data source binding
Posted: Wed Sep 26, 2007 2:09 pm
by 13045150
Using Visual Studio .NET 2005, how do I connect a data source to the webchart ? I can drag the webchart to the form and drag a SQLDataSource but cannot find away of binding together ie get access to datasource through Chart Editor/Series/Data Source/Database. I can do this easy enough as a Windows app but not as a web app.
Posted: Wed Sep 26, 2007 2:18 pm
by narcis
Hi jamesl,
There's no design-time support for databases in WebForms. It doesn't make much sense sending a dataset to a browser. I recommend you to read
this thread on how to achieve what you request.
Thanks in advance!
Posted: Wed Sep 26, 2007 2:34 pm
by 13045150
Hi Narcis, thanks for the reply.
I have read this thread several times now and still no clearer on finding a example on how to bind a SQL database against a chart against a webform.
Firstly, the examples that you point out are aimed towards Visual 2003 (not 2005) / Windows Forms (not webforms) and microsoft access databases (not sql server).
The Bindingsource steps only work for windows forms not webforms as we dont appear to have a 'Data' tab available!
Also, where do we gain access to the 'debug' verion appears to open up this functionality so that it is available for web forms?
You mention 'If necessary, I can also try to arrange a WebForm example in VS2005 using BindingSource for you.
' would this be more appropriate?
Any help appreciated.
James
Posted: Thu Sep 27, 2007 7:55 am
by narcis
Hi James,
Have you tried using the example pw posted in that thread?
Thanks in advance!
Posted: Thu Sep 27, 2007 8:29 am
by 13045150
Hi Narcis, as I have stated I have looked at the thread in question but this thread points to another thread which looks at bindingsource.
So,which example are you actually referring to?
Many thanks!
Posted: Thu Sep 27, 2007 9:22 am
by narcis
Hi James,
I'm referring to the thread I already pointed you:
http://www.teechart.net/support/viewtopic.php?t=3416
If you read the whole thread, you'll see that on 6th February 2006
pw posted an example on how to achieve something similar to what you request.
Thanks in advance.
Posted: Thu Sep 27, 2007 10:02 am
by 13045150
Hi Narcis, thanks for the reply we in fact did see the post but were confused by what the manual was telling us:-
'And Internet ! TeeChart Pro .Net is fully compatible with ASP.NET, being able to be placed on an ASP.NET WebForm and edited at design time in a completely WYSIWYG fashion'
Please can I confirm our current understanding, in that you cannot bind data at 'design time' and therefore cannot see what it is you are meant to be designing?
That all of the chart functionality which is easily accessible within a windows form by editing the control now needs to be dealt from within code?
However, we will pursue the posting that was made on the 6th Feb!
Many thanks!
Posted: Fri Sep 28, 2007 10:38 am
by Marc
Hello,
Confirmation:
WebChart does not recognise for the Chart Editor, the SQLDataAdapter at designtime.
Current connection code would take the following form:
Eg.
Code: Select all
protected void Page_Load(object sender, EventArgs e)
{
System.Web.UI.DataSourceSelectArguments dArgs = new DataSourceSelectArguments();
System.Data.DataView dView =new DataView();
//assumes SqlDataSource1 setup correctly to return data
dView = (System.Data.DataView)(SqlDataSource1.Select(dArgs));
WebChart1.Chart.Axes.Bottom.Labels.Angle = 90;
WebChart1.Chart[0].YValues.DataMember = dView.Table.Columns[1].ToString(); //yvalues
WebChart1.Chart[0].XValues.DataMember = dView.Table.Columns[2].ToString(); //xvalues
WebChart1.Chart[0].LabelMember = dView.Table.Columns[0].ToString(); //labels
WebChart1.Chart[0].DataSource = dView;
}
We'll put it on our prioirity list to see whether we can offer in the near future the SQLDataAdapter to the Editorlist of visible datasets.
Regards,
Marc Meumann