.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Threading SQL Query for Chart Control

Posted By:      Posted Date: October 14, 2010    Points: 0   Category :ASP.Net

I am trying to create a thread that runs a SQLCommand and binds that results to a Chart. When I run the code I get an Exception... "Object reference not set to an instance of an object." Here is a sample of my code. The exception occurs at this line of code.

"chtUserCount.Series["Series1"].Points.DataBindXY(ReaderResults, "Day Of Week", ReaderResults, "User Count");"


Any help would be greatly appreciated!



protected void Page_Load(object sender, EventArgs e)
            Thread UserCount = new Thread(new ThreadStart(UserCountThread));



void UserCountThread()
            SqlConnection AQConnect = new SqlConnection();

            //Daily User Count Chart

View Complete Post

More Related Resource Links

Validation Control Query



I've read that if you put a validation control on a page it performs the validation on the client AND server side.

My question is, if you've got a button's click event and you put code in there that puts submitted data into a database, how will the validation controls stop the data being inserted?

Is validation simply performed before anything else, then the page just stops?

using jquery tooltip with asp:Chart control


I'm trying to use qtip (jquery plugin) instead of the standard tooltip control provided for the asp:Chart. I think the best way to do this is with an img map, though I don't know how to implement it. Does anyone know how to implement the img map for an asp:Chart?

WPF Chart Control

Hi,I'm trying to locate the WPF chart control that Microsoft treated as an intern project a while back: http://channel9.msdn.com/ShowPost.aspx?PostID=232493  The reason that I'm interested is that I'm in the process of taking a Windows Forms graph control (think of a line graph versus a bar chart) and converting it to be a WPF one . and would be very interested in taking a look at what those two interns had done . to try and determine best practices and the right approach for our new WPF graph control. I contacted Kevin Moore and he thought that this component was getting pretty close to being released to the public. Anyone know the current status of it? Thanks, Cory

Chart control with sqldatasource?

Hi,I am working with chart controls in VS 2010. I have used sqldatasource. I want to populate select values from sqldatasource and display it on the chart controls.According to the chart samples: http://code.msdn.microsoft.com/mschart/Release/ProjectReleases.aspx?ReleaseId=4418the chart controls are databound in the page_load event. Then in which page event should I select data from sqldatasource?Code for sqldatasource selection will also be appreciated.Regards,ap.

Chart Control

I have a chart control in  my web page which is working fine on my local machine but the time I deploy my site on server, the chart control is causing prob........... I installed seperate exe for chart control...and copy dll as well but still error continues......can anybody help me?

Chart Control 3.5 - X-axis Labels

I have a fairly basic line graph which is bound to a SQLDataSource control.  The graph displays perfectly, but I want the labels on the X-axis to display vertically rather than horizontally.I have used the following code to try and do this but it is having no effect:<AxisX Title="Patient Safety Submissions" IsLabelAutoFit="True">    <LabelStyle Angle="90" interval="1" /></AxisX>Can anyone help?Here is the complete code for my chart:<asp:Chart ID="chrtHHcompliance" runat="server" DataSourceID="sqlHHcompliance" Width="1000px">                    <Titles>                        <asp:Title Font="Microsoft Sans Serif, 12pt, style=Bold, Underline"                                    Name="Title1" Text="Hand Hygiene Weekly Percentage Compliance">                 &nbs

How to draw Triangle in ASP.NET Chart Control

Hi I am looking for a control that can draw a very customized chart in ASP.NET.  The chart comprises: 1. A closed triangle, or polygon, shaded, drawn according to a fixed set of xy vertices. 2. A series of x,y points plotted on top of the triangle or polygon. I thought the chart Control wasthe best, but I can't figure out how to draw the close triangle or polygon. Is GDI+ the better way? Thanks   Alan

Printing MS Chart Control C# ASP.NET

I found a pretty good post on how to create a Print Helper class to print controls but am having quite a bit of difficulty getting it to work with MS Chart controls. Just to make sure the code worked in general, I used it with a drop down list control and it worked just fine. I tried placing the chart control within a panel and used the panel as the control to print, to no avail. Here is the code for the PrintHelper class I found: public class PrintHelper { public PrintHelper() { } public static void PrintWebControl(Control ctrl) { PrintWebControl(ctrl, string.Empty); } public static void PrintWebControl(Control ctrl, string Script) { StringWriter stringWrite = new StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite); if (ctrl is WebControl) { Unit w = new Unit(691, UnitType.Pixel); ((WebControl)ctrl).Width = w; } Page pg = new Page(); pg.EnableEventValidation = false; if (Script != string.Empty) //if (Script == string.Empty) { pg.ClientScript.RegisterStartupScript(pg.GetType(), "PrintJavaScript", Script); } HtmlForm frm = new HtmlForm(); pg.Controls.Add(frm); frm.Attributes.Add("runat", "server"); frm.Controls.Add(ctrl);

asp Hyperlink control using query string


Here is my problem:

I am passing a Customer ID using query string, however I also want to pass in a mode.  For example if the user clicks edit, I am using the hyperlink to re-direct them to the update Customer page.  In the hyperlink control I have a query string that is passing Customer ID and that works great, I also want to pass in MODE="E" (mode equals edit).

I am using the same Customer Edit page to edit current customer information and I am accessing it from an Add New Customer button.   I want to be able to pass in mode so I know whether they are editing or adding a new record.  I will then using this in code to determine what to do.

Here is what I have tried:

<asp:HyperLink ID="customer" runat="server" NavigateUrl='<%# "CustomerEdit.aspx?ID=" + Eval("CustomerID") &MODE="E" %>' Text="Modify" />

I keep getting an error that MODE does not exist in the current content...

Any suggestions???

GridView data to Chart Control


I have a GridView that is filled with databound data.  My problem is that I have a template field that uses the index + 1 for the gridview to give each record a unique number.  Then with this Gridview, with BoundFields and TemplateFields, I want to have this data to be the data for the chart control series.  How exactly is the best way to go about this?

Thanks in advance. :)

MS Chart control used in sharepoint webpart


Hello all,

I am using MS Chart control on sharepoint site. But i want to attach scrollbar to x and y axis .

Is there any way to attach scrollbar?

Chart Control getting numbers from GridView, but just duplicates


I have a gridview that I loop through to get the x and y values of the chart control, and upon the first execution of this code, it looks great.  But when the page posts back and it "refreshes" data, the original points on the chart control are still there, as well as the new values.

Is there any way to "delete" all data in the chart control to ensure this doesn't happen?  I can't seem to find any resources to help me out with this.

Thanks in advance. :)

Chart Control - Dashboards


What is the status of Microsoft ehancing the Chart Control to do dashboards, easily.


Chart Control


I have never been so frustrated. I have a Chart Control working that has one datapoint seies. However when I try to run one that has two series in the collection I keep getting the run time error "Additional information: A chart element with the name 'Week' could not be found in the 'SeriesCollection'." This is a problem because I have checked everything. I have named an item named Week in the SeriesCollections.Is there another setting that I need to be aware of . Please I need help. Thanks In Advance.

Chart Control


I am having a very difficult time rendering a chart control with 2 series of data. I can render a chart with one series of data but not with 2 series. When I run my app with the 2 series chart I dont get an error or anything I just get a blank chart. Does anyone know whats going on? Thanks for any help. I'm on a very tight deadline.

Chart Control doesn't show all labels



I'm trying to create a very simple Column chart.

There are 10 items in X axis, but chart shows only 3 of their labels.

For clarification, I'm trying to show Product sales count in chart. There are 10 products. In X axis, chart shows 10 products but, only 3 of them has a label for product name.

It should be a setting for this, bu I couldn't find it.

Thanks in advance

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend