T
TisMe
Hi All,
I have a problem that I am struck on, can you help?
1) I drag labelX onto the page
2) Create a new class 'myClass' which inherits system.web.ui.page
(Outside of the _default class for the page)
3) I now want to change a property of labelX, from a method within
myClass - How can I do this?
I have tried this (Within 'myClass')...
Label lblMess = new Label();
lblMess = (Label)FindControl("lblMessage");
lblMess.Text = "Hello Again World";
....which results in this error:
"Object reference not set to an instance of an object"
I know this means I am trying to access a null object, but really not
sure what to do to fix this?
I did think perhaps my method in 'myClass' needs to accept a byref
parameter type matching the control, is there another way? I'm sure I
am missing something simple here!
Thanks!!
Simon.
I have a problem that I am struck on, can you help?
1) I drag labelX onto the page
2) Create a new class 'myClass' which inherits system.web.ui.page
(Outside of the _default class for the page)
3) I now want to change a property of labelX, from a method within
myClass - How can I do this?
I have tried this (Within 'myClass')...
Label lblMess = new Label();
lblMess = (Label)FindControl("lblMessage");
lblMess.Text = "Hello Again World";
....which results in this error:
"Object reference not set to an instance of an object"
I know this means I am trying to access a null object, but really not
sure what to do to fix this?
I did think perhaps my method in 'myClass' needs to accept a byref
parameter type matching the control, is there another way? I'm sure I
am missing something simple here!
Thanks!!
Simon.