Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 27th, 2015, 06:36 PM
Authorized User
Points: 56, Level: 1
Points: 56, Level: 1 Points: 56, Level: 1 Points: 56, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2013
Location: Topeka, KS
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Default Problem using MS Chart in .net website

I have completed programming on my .NET 3.5 website and have just moved it to the production (Windows Server 2003) server. Have resolved several problems and everything is working now except MS Chart. I have installed MS Chart for .NET 3.5.
The website is data intensive using SQL Server Express 2005. On one of the pages, we pull data into a grid, then use the data in the grid to construct a chart. The data displays correctly in the grid, but when the button to evoke the chart is clicked, nothing happens (running in localhost). There is no error message, no visible change to the screen. Literally nothing happens. So far, I have not been able to find anything helpful for this problem. I hope someone has a suggestion. I have tried to find some setting in IIS that might apply to this problem, but no luck so far. Thanks.

Here is the button click code:

Code:
Protected Sub btnGraph_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGraph0.Click, btnGraph1.Click
        If createSQL() > 0 Then
            fillGraph()
            Results.ActiveViewIndex = 2
        End If
    End Sub
The createSQL() subroutine fills the grid with data. It is known to be working correctly. Here is the code for the fillGraph() subroutine. It seems odd that there isn't some sort of error message when this doesn't work.

Code:
Protected Sub fillGraph()
    'Init chart
    'This clears the default areas and series of the chart.
    Chart1.ChartAreas.Clear()
    Chart1.Series.Clear()

    'Create a chartarea
    Dim area As New ChartArea("AREA")
     'Add the chart area to the chart
    Chart1.ChartAreas.Add(area)
        'if charting motivations, add labels
        Chart1.Titles.Add(hfdLblGraph.Value)
    If chkItemAnal.Checked = False Then
      Dim lblAxisX As System.Web.UI.DataVisualization.Charting.CustomLabel = Chart1.ChartAreas("AREA").AxisX.CustomLabels.Add(0.5, 1.5, "Sensory", 0, LabelMarkStyle.LineSideMark)
      lblAxisX = Chart1.ChartAreas("AREA").AxisX.CustomLabels.Add(1.5, 2.5, "Escape", 0, LabelMarkStyle.LineSideMark)
      lblAxisX = Chart1.ChartAreas("AREA").AxisX.CustomLabels.Add(2.5, 3.5, "Attention", 0, LabelMarkStyle.LineSideMark)
      lblAxisX = Chart1.ChartAreas("AREA").AxisX.CustomLabels.Add(3.5, 4.5, "Tangible", 0, LabelMarkStyle.LineSideMark)
    End If

    If hfdFactors.Value > 0 Then
      Chart1.Legends.Add(New Legend("Legend1"))
      Chart1.Legends("Legend1").TextWrapThreshold = (15)
    End If
    If btlStatistic.SelectedValue = "confint" Then
      'Create a Series
      'Dim series As Series = New Series("SERIES")
      Dim series As Series = Chart1.Series.Add(("Series " + (Chart1.Series.Count + 1).ToString()))
      series.ChartType = SeriesChartType.RangeColumn

      'Assign the series to the area
      series.ChartArea = "AREA"
      'Add the data points. The Y data points must be in an array.
      'For unknown reasons, for the RangeColumn type chart, MSChart starts adding data points
      'at X=0, so start by adding one data point while the Y values are 0.  Similarly,
      'MSChart adds an extra data point at the end, so reset the Y values to 0 to keep
      'that data point from being visible

      Dim yVal() As Double = {0.0, 0.0}

      series.Points.Add.YValues = yVal
      For k = 0 To grdTable.Rows(0).Cells.Count - 2 Step 2
        yVal(0) = CDbl(grdTable.Rows(0).Cells(k).Text) - CDbl(Mid(grdTable.Rows(0).Cells(k + 1).Text, 4))
        yVal(1) = CDbl(grdTable.Rows(0).Cells(k).Text) + CDbl(Mid(grdTable.Rows(0).Cells(k + 1).Text, 4))
                If yVal(0) = yVal(1) Then   'if the interval is 0, add a bit so the average value will show
                    yVal(0) = yVal(0) - 0.04
                    yVal(1) = yVal(1) + 0.04
                End If
        series.YValuesPerPoint = 2
        series.BackHatchStyle = ChartHatchStyle.DarkDownwardDiagonal
        series.Points.Add.YValues = yVal
      Next
      yVal(0) = 0
      yVal(1) = 0
    Else
      For i = 0 To grdTable.Rows.Count - 1
        'Create a Series
        Dim series As Series = Chart1.Series.Add(("Series " + (Chart1.Series.Count + 1).ToString()))
        series.ChartType = SeriesChartType.Column
        'Assign the series to the area
        series.ChartArea = "AREA"

        If hfdFactors.Value > 0 Then
          Dim lstring As String = ""
          For l = 0 To CInt(hfdFactors.Value) - 1
            lstring = lstring & grdTable.Rows(i).Cells(l).Text & " X "
          Next
          series.LegendText = lstring.Substring(0, Len(lstring) - 3)
        End If
        'Add data to the series
        For k = 1 To grdTable.Rows(i).Cells.Count - hfdFactors.Value
          series.Points.AddXY(k, CType(grdTable.Rows(i).Cells(hfdFactors.Value + k - 1).Text, String))
        Next
      Next

    End If
  End Sub

Here is the web.config file:

Code:
<?xml version="1.0"?>
<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config 
-->
<configuration>
	<configSections>
		<sectionGroup name="system.web.extensions" 
                  type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
			<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
				<section name="scriptResourceHandler" 
                 type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" 
                 requirePermission="false" 
                 allowDefinition="MachineToApplication"/>
				<sectionGroup name="webServices" 
                      type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
					<section name="jsonSerialization" 
                   type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" 
                   requirePermission="false" 
                   allowDefinition="Everywhere"/>
					<section name="profileService" 
                   type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" 
                   requirePermission="false" 
                   allowDefinition="MachineToApplication"/>
					<section name="authenticationService" 
                   type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" 
                   requirePermission="false" 
                   allowDefinition="MachineToApplication"/>
					<section name="roleService" 
                   type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" 
                   requirePermission="false" 
                   allowDefinition="MachineToApplication"/>
				</sectionGroup>
			</sectionGroup>
		</sectionGroup>
	</configSections>
	<appSettings>
  <add key="ChartImageHandler" 
       value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
 </appSettings>
	<connectionStrings>
		<add name="iMASSQLConnectionString" 
         connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\iMASSQL.mdf;Integrated Security=True;Initial Catalog=AspMembership;User Instance=True" 
         providerName="System.Data.SqlClient"/>
		<!--<add name="iMASSQLConnectionString1" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\iMASSQL.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>-->
	</connectionStrings>
	<system.web>
		<!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.

            Visual Basic options:
            Set strict="true" to disallow all data type conversions 
            where data loss can occur. 
            Set explicit="true" to force declaration of all variables.
        -->
		

		<compilation debug="true" strict="false" explicit="true">
			<assemblies>
				<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
				<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
				<add assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
				<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>
		</compilation>
		<pages>
   <namespaces>
    <clear />
    <add namespace="System" />
    <add namespace="System.Collections" />
    <add namespace="System.Collections.Generic" />
    <add namespace="System.Collections.Specialized" />
    <add namespace="System.Configuration" />
    <add namespace="System.Text" />
    <add namespace="System.Text.RegularExpressions" />
    <add namespace="System.Linq" />
    <add namespace="System.Xml.Linq" />
    <add namespace="System.Web" />
    <add namespace="System.Web.Caching" />
    <add namespace="System.Web.SessionState" />
    <add namespace="System.Web.Security" />
    <add namespace="System.Web.Profile" />
    <add namespace="System.Web.UI" />
    <add namespace="System.Web.UI.WebControls" />
    <add namespace="System.Web.UI.WebControls.WebParts" />
    <add namespace="System.Web.UI.HtmlControls" />
   </namespaces>
   <controls>
    <add tagPrefix="asp" namespace="System.Web.UI" 
         assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add tagPrefix="asp" namespace="System.Web.UI.WebControls" 
         assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting"
     assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
   </controls>
  </pages>
		<!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
		<membership>
			<providers>
        <clear />
				<add connectionStringName="iMASSQLConnectionString" 
             enablePasswordRetrieval="false" 
             enablePasswordReset="true" 
             requiresQuestionAndAnswer="true" 
             applicationName="/iMAS" 
             requiresUniqueEmail="false" 
             passwordFormat="Clear" 
             maxInvalidPasswordAttempts="5" 
             minRequiredPasswordLength="7" 
             minRequiredNonalphanumericCharacters="1" 
             passwordAttemptWindow="10" 
             passwordStrengthRegularExpression="" 
             name="AspNetSqlMembershipProvider" 
             type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
			</providers>
		</membership>
    <profile>
      <providers>
        <clear />
        <add name="AspNetSqlProfileProvider" 
             connectionStringName="iMASSQLConnectionString" 
             applicationName="/iMAS" 
             type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
      </providers>
    </profile>
    <roleManager enabled="true" defaultProvider="AspNetSqlRoleProvider">
      <providers>
        <clear />
        <add connectionStringName="iMASSQLConnectionString"
             applicationName="/iMAS"
             name="AspNetSqlRoleProvider"
             type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
      </providers>
    </roleManager>
		<authentication mode="Forms"/>
		<!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
		<httpHandlers>
   <remove path="*.asmx" verb="*" />
   <add path="*.asmx" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
    validate="false" />
   <add path="*_AppService.axd" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
    validate="false" />
   <add path="ScriptResource.axd" verb="GET,HEAD" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
    validate="false" />
   <add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    validate="false" />
  </httpHandlers>
		<httpModules>
			<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
		</httpModules>
	</system.web>
	<system.codedom>
		<compilers>
			<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
				<providerOption name="CompilerVersion" value="v3.5"/>
				<providerOption name="WarnAsError" value="false"/>
			</compiler>
			<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
				<providerOption name="CompilerVersion" value="v3.5"/>
				<providerOption name="OptionInfer" value="true"/>
				<providerOption name="WarnAsError" value="false"/>
			</compiler>
		</compilers>
	</system.codedom>
	<!-- 
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services 7.0.  It is not necessary for previous version of IIS.
    -->
	<system.webServer>
  <validation validateIntegratedModeConfiguration="false" />
  <modules>
   <remove name="ScriptModule" />
   <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  </modules>
  <handlers>
   <remove name="WebServiceHandlerFactory-Integrated" />
   <remove name="ScriptHandlerFactory" />
   <remove name="ScriptHandlerFactoryAppServices" />
   <remove name="ScriptResource" />
   <remove name="ChartImageHandler" />
   <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
    type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
   <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd"
    preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
   <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD"
    path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
   <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST"
    path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </handlers>
 </system.webServer>
  <system.net>
    <mailSettings>
      <smtp deliveryMethod="Network" from="Monaco &lt;support@monacoassociates.com&gt;">
        <network host="mail.cjnetworks.com"/>
      </smtp>
    </mailSettings>
  </system.net>
	<runtime>
		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
			<dependentAssembly>
				<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
				<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
			</dependentAssembly>
			<dependentAssembly>
				<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
				<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
			</dependentAssembly>
		</assemblyBinding>
	</runtime>
  <location path ="UserPages">
    <system.web>
      <authorization>
        <allow roles="User" />
        <allow roles="SuperUser" />
        <allow roles="Admin" />
        
      </authorization>
    </system.web>
  </location>
</configuration>
Reply With Quote
  #2 (permalink)  
Old August 30th, 2015, 09:13 PM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,957
Thanks: 79
Thanked 1,556 Times in 1,533 Posts
Default

Hi there,

Since this outside the scope of the book, you're better off posting this in a generic ASP.NET category to hopefully draw more viewers who may have a clue what's going on.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #3 (permalink)  
Old September 1st, 2015, 03:50 PM
Authorized User
Points: 56, Level: 1
Points: 56, Level: 1 Points: 56, Level: 1 Points: 56, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2013
Location: Topeka, KS
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks, I have posted it in an ASP.net forum.
Reply With Quote
  #4 (permalink)  
Old January 15th, 2016, 04:12 AM
Registered User
Points: 90, Level: 1
Points: 90, Level: 1 Points: 90, Level: 1 Points: 90, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank pro share ASP.NET
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
WHY only in VB:( - - - ASP.NET 3.5 Website Programming: Problem - Design - Solution g_h BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 30 October 23rd, 2009 05:11 PM
MS Chart Question eusanpe C# 0 November 10th, 2007 07:33 PM
ASP.NET Website Programming: Problem - Design - So YourPhobia ASP.NET 1.0 and 1.1 Basics 0 March 5th, 2006 10:15 AM
VB App creating an Area Chart in MS Word mbyndas VB How-To 0 September 30th, 2003 09:18 AM



All times are GMT -4. The time now is 11:30 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.