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,
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(); }