I have an UltraChart inside an update panel. The initial load of the page renders the chart correctly, but if I do any sort of postback, the old image remains. Here are the things I've checked:
Here is the code which is creating this:
protected void Page_Load(object sender, EventArgs e){ ChartDataBind(); }
private void ChartDataBind() {
// Added this per the suggestion on another forum post to resolve a similar issue UltraChart1.DataSource = null; UltraChart1.Series.Clear();
SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["BillingProductivityConnectionString"].ConnectionString); SqlCommand cmd = new SqlCommand("uspEmployeeProductivityDetails_TransactionTrend", conn); cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@ClientID", hdnClientID.Value); cmd.Parameters.AddWithValue("@ClientEmployeeID", hdnEmployeeID.Value); cmd.Parameters.AddWithValue("@FromDate", lblFromDate.Text); cmd.Parameters.AddWithValue("@ToDate", lblToDate.Text); cmd.Parameters.AddWithValue("@TransFilter", WebDropDown1.CurrentValue ?? ""); cmd.Parameters.AddWithValue("@QtyOrPts", rblTT_QtyOrPts.SelectedValue);
DataTable dt = new DataTable(); conn.Open(); dt.Load(cmd.ExecuteReader()); conn.Close();
cmd.Dispose(); conn.Dispose(); UltraChart1.DataSource = dt; UltraChart1.DataBind();
}
<asp:UpdatePanel ID="upnlChart" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="rblTT_QtyOrPts" /> <asp:AsyncPostBackTrigger ControlID="WebDropDown1" EventName="SelectionChanged" /> </Triggers> <ContentTemplate>
<div class="content-panel-header"> <div style="display: inline-block;">Transaction Trend</div> <div class="content-panel-header-criteria"> <div style="display: inline-block; ">Metric: </div> <asp:RadioButtonList ID="rblTT_QtyOrPts" runat="server" AutoPostBack="true" RepeatDirection="Horizontal" RepeatLayout="Flow" style="display: inline-block; margin-right: 25px;"> <asp:ListItem Text="Qty" Value="Qty" Selected="True" /> <asp:ListItem Text="Points" Value="Pts" Selected="False" /> </asp:RadioButtonList> <asp:RadioButtonList ID="rblTimePeriod" runat="server" AutoPostBack="true" RepeatDirection="Horizontal" RepeatLayout="Flow" style="display: inline-block; margin-right: 25px;"> <asp:ListItem Text="Hours" Value="Hours" Selected="True" /> <asp:ListItem Text="Days" Value="Days" Selected="False" /> <asp:ListItem Text="Months" Value="Months" Selected="False" /> </asp:RadioButtonList> <div style="display: inline-block;"> <asp:UpdateProgress ID="UpdateProgress1" runat="server"> <ProgressTemplate> <asp:Image ID="img2Ajax" runat="server" ImageUrl="~/Images/ajax-loader.gif" style="height: 15px; display: inline-block;" /> </ProgressTemplate> </asp:UpdateProgress> </div> </div> </div> <div class="criteria-panel">Transaction Filter <ig:WebDropDown ID="WebDropDown1" runat="server" Width="800px" DataKeyFields="Trans" DataSourceID="ObjectDataSource2" TextField="Trans" ValueField="Trans" OnSelectionChanged="WebDropDown1_SelectionChanged" AutoPostBackFlags-SelectionChanged="On"> </ig:WebDropDown> </div>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="Dashboards.BillingProductivityDataSetTableAdapters.uspProductivity_GetEmployeeTransactionTypesTableAdapter"> <SelectParameters> <asp:ControlParameter ControlID="hdnClientID" Name="ClientID" PropertyName="Value" Type="Int32" /> <asp:ControlParameter ControlID="hdnEmployeeID" Name="ClientEmployeeID" PropertyName="Value" Type="Int32" /> <asp:ControlParameter ControlID="lblFromDate" Name="FromDate" PropertyName="Text" Type="DateTime" /> <asp:ControlParameter ControlID="lblToDate" Name="ToDate" PropertyName="Text" Type="DateTime" /> </SelectParameters> </asp:ObjectDataSource>
<igchart:UltraChart ID="UltraChart1" runat="server" ChartType="LineChart" EmptyChartText="Data Not Available. Please call UltraChart.Data.DataBind() after setting valid Data.DataSource" Height="487px" Version="16.1" Width="1036px" DeploymentScenario-Scenario="FileSystem"> </igchart:UltraChart> </ContentTemplate></asp:UpdatePanel>
I actually resolved this problem on my own. I should probably delete this post, but I don't think I'm able to.
Hello Boyd,
Does removing the UpdatePanel result in the expected behavior of the UltraChart?
Please provide the forum thread that provided the fix you attempted in the code.