On Feb 19, 3:57 pm, "Scott Roberts" <srobe...@no.spam.here-webworks-
software.com> wrote:
> > Suppose I create a button on the fly and assign an event handler to it
> > in the code-behind like so:
[quoted text clipped - 29 lines]
>
> - Show quoted text -
Thank both of you. I was tring to see what methods intellisense would
show me while I typed up sender dot. But none of those seemed to be
helpful.
Now that I realize that I can cast the sender object to the type of
the object which raised the event, I also realize that I might have
simplified my question.
I am actually using Dundas to create some charts on the fly. For
example, I create Chart1 on the fly and put it in a placeholder. In
the Dundas GanttChart example, there is a Chart1_PostPaint event
handler which draws stuff on the chart *after* the chart has been
rendered (my understanding). The example code goes like this:
private void Chart1_PostPaint(object sender,
Dundas.Charting.WebControl.ChartPaintEventArgs e)
{
if(sender is ChartArea)
{
Series series = Chart1.Series["Tasks"];
// [snip]
}
}
Note that in their example, this Chart1 is declared in the aspx file.
The problem for me is that whereas the *sender* is ChartArea, they are
referring to Chart1, which is not a ChartArea, but some kind of parent
of ChartArea. I can't seem to get a reference to the parent from the
*sender* ChartArea. That's why I got stuck.
Mark: I did try declaring Chart1 as a class-level private member, but
it did not help.
gnewsgroup - 19 Feb 2008 21:38 GMT
> On Feb 19, 3:57 pm, "Scott Roberts" <srobe...@no.spam.here-webworks-
>
[quoted text clipped - 72 lines]
>
> - Show quoted text -
I had a method that returns the newly-created chart, now I declare
Chart1 as private member, and the method is changed to return void and
keeps updating chart1 contents and then in the PostPaoint event, I
refer to it as this.Chart1. It works! I didn't think it through.
Thanks for Mark!