R
Rolf Welskes
Hello,
the problem seems simple
I have an own webcontrol
one property is
public bool IsEdit
{
get
{
...
}
set
{
...
}
//then there is CreateChildControls()
override void CreateChildControls()
{
if(IsEdit)
{
TextBox tx = new TextBox()
Controls.Add(tx)
}
else
{
Label lbl = new Label()
Controls.Add(lbl);
}
}
this is the princip. If the property IsEdit is true, an edit-control should
be shown, if not a label should be shown.
Now if for example IsEdit is true und saved in the ViewState.
Now a Postback is made.
So, the CreateChildControl should create the editbox, but no it does not,
because the ViewState is available after the call of CreateChildControls.
It also is not possible to call CreateChildControls later from my own code,
because the textbox has text also saved over the viewState and
after postback the textbox must be availabel to set the text of the
viewstate (bei the asp-system).
So how can I solve this problem?
I need the possiblitiy before the CreateChildControl is called by the
control-base-class to have an information IsEdit true or not.
But ViewState and ControlState both are available later.
Thank you for any help.
Rolf Welskes
the problem seems simple
I have an own webcontrol
one property is
public bool IsEdit
{
get
{
...
}
set
{
...
}
//then there is CreateChildControls()
override void CreateChildControls()
{
if(IsEdit)
{
TextBox tx = new TextBox()
Controls.Add(tx)
}
else
{
Label lbl = new Label()
Controls.Add(lbl);
}
}
this is the princip. If the property IsEdit is true, an edit-control should
be shown, if not a label should be shown.
Now if for example IsEdit is true und saved in the ViewState.
Now a Postback is made.
So, the CreateChildControl should create the editbox, but no it does not,
because the ViewState is available after the call of CreateChildControls.
It also is not possible to call CreateChildControls later from my own code,
because the textbox has text also saved over the viewState and
after postback the textbox must be availabel to set the text of the
viewstate (bei the asp-system).
So how can I solve this problem?
I need the possiblitiy before the CreateChildControl is called by the
control-base-class to have an information IsEdit true or not.
But ViewState and ControlState both are available later.
Thank you for any help.
Rolf Welskes