B
BjornColtof
I'm trying to create a CompositeControl derived class to implement a control
that will enable people to edit an account object. The properties of an
account like email, name, etc. should be edited with textboxes. A
CompositeControl-derived class should fit this scenario. The problem I'm
running into is that although I can set the initial entries in the textboxes,
I don't know how to retrieve them at runtime.
I have a property on the control like userName that does something like this:
public string UserName
{
get
{
return (string) ViewState["UserName"];
}
set
{
ViewState["UserName"] = value;
}
}
In the function CreateChildControls I create the check box an set its
initial value to the value of this property, which I set in the OnLoad of the
Page (if !IsPostback). My problem is that in the handler of the change button
(which isn't part of the control) I don';t know how to retrieve the new
UserName. Quering the property above will only result in the old value. How
can I put the right value of the UserName property into the ViewState?
that will enable people to edit an account object. The properties of an
account like email, name, etc. should be edited with textboxes. A
CompositeControl-derived class should fit this scenario. The problem I'm
running into is that although I can set the initial entries in the textboxes,
I don't know how to retrieve them at runtime.
I have a property on the control like userName that does something like this:
public string UserName
{
get
{
return (string) ViewState["UserName"];
}
set
{
ViewState["UserName"] = value;
}
}
In the function CreateChildControls I create the check box an set its
initial value to the value of this property, which I set in the OnLoad of the
Page (if !IsPostback). My problem is that in the handler of the change button
(which isn't part of the control) I don';t know how to retrieve the new
UserName. Quering the property above will only result in the old value. How
can I put the right value of the UserName property into the ViewState?