Hello,
1-I have a master page,
2-I have a user control for a webChart.
I want to use WARP in my page.
I have a button and when i click on it, new data will be generated for the webchart user control.
If i use the warp in a webForm page, i have no problem and the WARP wotks perfectly. But if i use a master page, the warp does not work.
Have you any idea?
Thank you in advance.
HI,
I could not reproduce your issue. I created a Master page - Content page had usercontrol with a chart and button. I ran the application and it worked as expected.
here is my master page:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Untitled Page</title> <asp:ContentPlaceHolder id="head" runat="server"> </asp:ContentPlaceHolder></head><body> <form id="form1" runat="server"> <div> <asp:Label ID="Label1" runat="server" Text="Master page"></asp:Label> <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </div> </form></body></html>
Here my page:
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" Title="Untitled Page" %>
<%@ Register assembly="Infragistics2.WebUI.Misc.v9.1, Version=9.1.20091.1015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.WebUI.Misc" tagprefix="igmisc" %>
<%@ Register src="WebUserControl.ascx" tagname="WebUserControl" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <igmisc:WebAsyncRefreshPanel ID="WebAsyncRefreshPanel1" runat="server" Height="320px" Width="380px"> <uc1:WebUserControl ID="WebUserControl1" runat="server" /> </igmisc:WebAsyncRefreshPanel></asp:Content>
Here is my user control
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %><%@ Register assembly="Infragistics2.WebUI.UltraWebChart.v9.1, Version=9.1.20091.1015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.WebUI.UltraWebChart" tagprefix="igchart" %><%@ Register assembly="Infragistics2.WebUI.UltraWebChart.v9.1, Version=9.1.20091.1015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.UltraChart.Resources.Appearance" tagprefix="igchartprop" %><%@ Register assembly="Infragistics2.WebUI.UltraWebChart.v9.1, Version=9.1.20091.1015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.UltraChart.Data" tagprefix="igchartdata" %><igchart:UltraChart ID="UltraChart1" runat="server" BackgroundImageFileName="" BorderColor="Black" BorderWidth="0px" EmptyChartText="Data Not Available. Please call UltraChart.Data.DataBind() after setting valid Data.DataSource" Version="9.1"> <colormodel alphalevel="150" colorbegin="Pink" colorend="DarkRed" modelstyle="CustomLinear"> </colormodel> <axis> <pe elementtype="None" fill="Cornsilk" /> <x linethickness="1" tickmarkinterval="0" tickmarkstyle="Smart" visible="True"> <majorgridlines alphalevel="255" color="Gainsboro" drawstyle="Dot" thickness="1" visible="True" /> <minorgridlines alphalevel="255" color="LightGray" drawstyle="Dot" thickness="1" visible="False" /> <labels font="Verdana, 7pt" fontcolor="DimGray" horizontalalign="Near" itemformatstring="<ITEM_LABEL>" orientation="VerticalLeftFacing" verticalalign="Center"> <serieslabels font="Verdana, 7pt" fontcolor="DimGray" horizontalalign="Center" orientation="Horizontal" verticalalign="Center"> <layout behavior="Auto"> </layout> </serieslabels> <layout behavior="Auto"> </layout> </labels> </x> <y linethickness="1" tickmarkinterval="10" tickmarkstyle="Smart" visible="True"> <majorgridlines alphalevel="255" color="Gainsboro" drawstyle="Dot" thickness="1" visible="True" /> <minorgridlines alphalevel="255" color="LightGray" drawstyle="Dot" thickness="1" visible="False" /> <labels font="Verdana, 7pt" fontcolor="DimGray" horizontalalign="Far" itemformatstring="<DATA_VALUE:00.##>" orientation="Horizontal" verticalalign="Center"> <serieslabels font="Verdana, 7pt" fontcolor="DimGray" horizontalalign="Center" orientation="VerticalLeftFacing" verticalalign="Center"> <layout behavior="Auto"> </layout> </serieslabels> <layout behavior="Auto"> </layout> </labels> </y> <y2 linethickness="1" tickmarkinterval="10" tickmarkstyle="Smart" visible="False"> <majorgridlines alphalevel="255" color="Gainsboro" drawstyle="Dot" thickness="1" visible="True" /> <minorgridlines alphalevel="255" color="LightGray" drawstyle="Dot" thickness="1" visible="False" /> <labels font="Verdana, 7pt" fontcolor="Gray" horizontalalign="Near" itemformatstring="<DATA_VALUE:00.##>" orientation="Horizontal" verticalalign="Center" visible="False"> <serieslabels font="Verdana, 7pt" fontcolor="Gray" horizontalalign="Center" orientation="VerticalLeftFacing" verticalalign="Center"> <layout behavior="Auto"> </layout> </serieslabels> <layout behavior="Auto"> </layout> </labels> </y2> <x2 linethickness="1" tickmarkinterval="0" tickmarkstyle="Smart" visible="False"> <majorgridlines alphalevel="255" color="Gainsboro" drawstyle="Dot" thickness="1" visible="True" /> <minorgridlines alphalevel="255" color="LightGray" drawstyle="Dot" thickness="1" visible="False" /> <labels font="Verdana, 7pt" fontcolor="Gray" horizontalalign="Far" itemformatstring="<ITEM_LABEL>" orientation="VerticalLeftFacing" verticalalign="Center" visible="False"> <serieslabels font="Verdana, 7pt" fontcolor="Gray" horizontalalign="Center" orientation="Horizontal" verticalalign="Center"> <layout behavior="Auto"> </layout> </serieslabels> <layout behavior="Auto"> </layout> </labels> </x2> <z linethickness="1" tickmarkinterval="0" tickmarkstyle="Smart" visible="False"> <majorgridlines alphalevel="255" color="Gainsboro" drawstyle="Dot" thickness="1" visible="True" /> <minorgridlines alphalevel="255" color="LightGray" drawstyle="Dot" thickness="1" visible="False" /> <labels font="Verdana, 7pt" fontcolor="DimGray" horizontalalign="Near" itemformatstring="" orientation="Horizontal" verticalalign="Center"> <serieslabels font="Verdana, 7pt" fontcolor="DimGray" horizontalalign="Center" orientation="Horizontal" verticalalign="Center"> <layout behavior="Auto"> </layout> </serieslabels> <layout behavior="Auto"> </layout> </labels> </z> <z2 linethickness="1" tickmarkinterval="0" tickmarkstyle="Smart" visible="False"> <majorgridlines alphalevel="255" color="Gainsboro" drawstyle="Dot" thickness="1" visible="True" /> <minorgridlines alphalevel="255" color="LightGray" drawstyle="Dot" thickness="1" visible="False" /> <labels font="Verdana, 7pt" fontcolor="Gray" horizontalalign="Near" itemformatstring="" orientation="Horizontal" verticalalign="Center" visible="False"> <serieslabels font="Verdana, 7pt" fontcolor="Gray" horizontalalign="Center" orientation="Horizontal" verticalalign="Center"> <layout behavior="Auto"> </layout> </serieslabels> <layout behavior="Auto"> </layout> </labels> </z2> </axis> <effects> <effects> <igchartprop:GradientEffect /> </effects> </effects> <border thickness="0" /> <tooltips font-bold="False" font-italic="False" font-overline="False" font-strikeout="False" font-underline="False" /></igchart:UltraChart><asp:Button ID="Button1" runat="server" onclick="Button1_Click1" Text="Add Data" />
Here is my usercontrol code-behind.
using System;using System.Collections;using System.Configuration;using System.Data;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using Infragistics.UltraChart.Shared.Styles;using Infragistics.UltraChart.Resources.Appearance;using Infragistics.UltraChart.Core.Layers;
public partial class WebUserControl : System.Web.UI.UserControl{ protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { UltraChart1.DataSource = GetData(); UltraChart1.DataBind(); UltraChart1.Axis.Y.RangeMax = 6; UltraChart1.Axis.Y.RangeMin = 0; UltraChart1.Axis.Y.RangeType = AxisRangeType.Custom; } } protected void Button1_Click1(object sender, EventArgs e) { UltraChart1.DataSource = GetDatax(); UltraChart1.DataBind(); UltraChart1.Axis.Y.RangeMax = 6; UltraChart1.Axis.Y.RangeMin = 0; UltraChart1.Axis.Y.RangeType = AxisRangeType.Custom; }
private static DataTable GetData() { DataTable table = new DataTable(); table.Columns.Add("Label Column", typeof(string)); table.Columns.Add("sales", typeof(double)); table.Columns.Add("presales", typeof(double)); table.Rows.Add(new object[] { "Point A", 1.0, 3.0 }); table.Rows.Add(new object[] { "Point B", 2.0, 2.0 }); table.Rows.Add(new object[] { "Point C", 3.0, 1.0 }); table.Rows.Add(new object[] { "Point D", 4.0, 2.0 }); table.Rows.Add(new object[] { "Point E", 5.0, 3.0 }); return table; } private static DataTable GetDatax() { DataTable table = new DataTable(); table.Columns.Add("Label Column", typeof(string)); table.Columns.Add("Sales", typeof(double)); table.Columns.Add("Presales", typeof(double)); table.Rows.Add(new object[] { "Point A", 1.0, 3.0 }); table.Rows.Add(new object[] { "Point B", 2.0, 2.0 }); table.Rows.Add(new object[] { "Point C", 3.0, 1.0 }); table.Rows.Add(new object[] { "Point D", 4.0, 2.0 }); table.Rows.Add(new object[] { "Point E", 5.0, 3.0 }); table.Rows.Add(new object[] { "Point F", 6.0, 4.0 }); return table; } }
Thank you for your response,
In my senario, i don't have the Button in the usercontrol. I have to put it outside the usercontrol.
I tried your example by putting the button on the page, but it does not work;
Could you please try it.
Here is my project
Thank you for your response. In fact, i was did the same thing, before i send you my question, and it does not work. If it works for you, could you please send me the complete code.
Thank you .
You can use the warp -
in your user control expose a public property that points to the chart inside of the user control
Here is the code snippet: from the user control
public UltraChart uc = null; protected void Page_Load(object sender, EventArgs e) { uc = UltraChart1;
now on your main page - wire up a button click event and have it access this new public property of the user control
Here is the code snippet: from your main page - where the data is coming from
private static DataTable GetData() { DataTable table = new DataTable(); table.Columns.Add("Label Column", typeof(string)); table.Columns.Add("sales", typeof(double)); table.Columns.Add("presales", typeof(double)); table.Rows.Add(new object[] { "Point u", 1.0, 3.0 }); table.Rows.Add(new object[] { "Point v", 2.0, 2.0 }); table.Rows.Add(new object[] { "Point w", 3.0, 1.0 }); table.Rows.Add(new object[] { "Point x", 4.0, 2.0 }); table.Rows.Add(new object[] { "Point y", 5.0, 3.0 }); return table; } protected void Button3_Click(object sender, EventArgs e) { WebUserControl wuc1 = (WebUserControl)WebAsyncRefreshPanel1.FindControl("WebUserControl1"); wuc1.uc.DataSource = GetData(); wuc1.uc.DataBind();
}
Thank you for your response.
I bind the data to my webchart usercontrol dynamicly. i.e the refresh() method is not in my uer control but in my web page. in other word, i bind the data to my webchart usercontrol from the webpage and not from my usercontrol.
Do you think that it is possible to use the WARP in that case?
Ok , in the WebUserControl - create a public method to add data to the chart
here is the code snippet:
public void refresh() { UltraChart1.DataSource = GetDatax(); UltraChart1.DataBind(); UltraChart1.Axis.Y.RangeMax = 6; UltraChart1.Axis.Y.RangeMin = 0; UltraChart1.Axis.Y.RangeType = AxisRangeType.Custom;
Now in the page with the warp - add your button and in the click method
put the folloiwng code
protected void Button1_Click(object sender, EventArgs e) { WebUserControl wuc1 = (WebUserControl) WebAsyncRefreshPanel1.FindControl("WebUserControl1"); wuc1.refresh(); }