Hi
I want to bind a picturebox Dynamically to an image field in database.
I use this code (I'm Using Northwind Database):
| using (DataClasses1DataContext dc=new DataClasses1DataContext()) |
| { |
| var a = from p in dc.Products |
| join c in dc.Categories |
| on p.CategoryID equals c.CategoryID |
| select new |
| { |
| ProductName=p.ProductName, |
| UnitPrice=p.UnitPrice, |
| UnitInStock=p.UnitsInStock, |
| CatName=c.CategoryName, |
| CatPic=c.Picture |
| }; |
| this.DataSource = a.ToList(); |
| } |
private void chart1_NeedDataSource(object sender, EventArgs e)
{
chart1.DefaultType = ChartSeriesType.Line;
ArrayList al = new ArrayList();
al = (ArrayList)this.ReportParameters[0].Value;
(sender as Telerik.Reporting.Processing.Chart).DataSource= this.serverAvgCPUDS.ServerAvgCPUDSTable;
foreach (string s in al)
{
ChartSeries series = new ChartSeries(s.ToString());
series.Type = ChartSeriesType.Line;
series.DataYColumn = "Percent";
series.DataLabelsColumn = "Time";
chart1.Series.Add(series);
series = null;
}
}