Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Dec 16, 2006 01:49 AM|LINK
I think you're right.
I spent the better part of a few hours learning a little about Python and reading this whitepaper:
Normally with VB and C# your class is inherited from the generated page class and has access to all the members of that class, which includes controls, etc. However, with Python, no inheritance is taking place. A class, called ScriptPage, is instantiated
directly and injected into what would normally be page methods like Page_Init, Page_Load, etc. Therefore, my button event handler is not part of any class and has no clue about the label.
Rather than using a global variable, however, we do have access to the sender object ( of type button in this case ), which does expose a Page property that does give us access to the ScriptPage. We will set the text of the label that way:
Button1.Click += Button1_Click
def Button1_Click(sender, args):
sender.Page.Label1.Text = "button1"
I appreciate the comments scotts as it got me in the right direction.