May 21, 2009, 7:49 PM
[CLOSED] [component].Disabled = false is not the same as [component].Enabled = true
Hi,
we have found a strange effect:
If we use 'mapButton.Disabled = false;' instead of 'mapButton.Enabled = true;'
and click the mapButton twice we receive a
System.Web.HttpException: The control with ID 'MapButton' not found
Please take a look into Coolite.Ext.Web\Ext\Component.cs
If I change
What is or should be the difference between the properties 'Enabled' and 'Disabled' ?
Regards,
M. Blume
we have found a strange effect:
public partial class WebForm2 : System.Web.UI.Page
{
ToolbarButton mapButton = new ToolbarButton();
protected void Page_Load(object sender, EventArgs e)
{
...
CreateToolbar(update)
...
}
void CreateToolbar(bool update)
{
Toolbar tb = new Toolbar();
...
mapButton = new ToolbarButton();
mapButton.Icon = Icon.FolderAdd;
mapButton.AjaxEvents.Click.Before = "parent.window.StatusBar.showBusy();";
mapButton.Text = "...";
mapButton.AjaxEvents.Click.Event += new ComponentAjaxEvent.AjaxEventHandler(this.AddToMap);
mapButton.AjaxEvents.Click.ExtraParams.Add(new Coolite.Ext.Web.Parameter("NodeID", "parent.window.CurrentNodeID.getValue()", ParameterMode.Raw));
mapButton.AjaxEvents.Click.EventMask.ShowMask = true;
mapButton.AjaxEvents.Click.EventMask.Msg = "...";
mapButton.AjaxEvents.Click.EventMask.MinDelay = 200;
mapButton.ID = "MapButton";
mapButton.Hidden = !update;
tb.Items.Add(mapButton);
...
}
protected void AddToMap(object sender, AjaxEventArgs e)
{
mapButton.Disabled = true;
try
{
...
}
...
finally
{
// mapButton.Enabled = true;
mapButton.Disabled = false;
}
}
...
}
The effect:If we use 'mapButton.Disabled = false;' instead of 'mapButton.Enabled = true;'
and click the mapButton twice we receive a
System.Web.HttpException: The control with ID 'MapButton' not found
Please take a look into Coolite.Ext.Web\Ext\Component.cs
If I change
public virtual bool Disabled
{
get
{
object obj = this.ViewState["Disabled"];
return (obj == null) ? false : (bool)obj;
}
set
{
this.ViewState["Disabled"] = value;
}
}
public override bool Enabled
{
get
{
return base.Enabled;
}
set
{
this.Disabled = !value;
base.Enabled = value;
}
}
into public virtual bool Disabled
{
get
{
object obj = this.ViewState["Disabled"];
return (obj == null) ? false : (bool)obj;
}
set
{
this.ViewState["Disabled"] = value;
base.Enabled = !value;
}
}
public override bool Enabled
{
get
{
return base.Enabled;
}
set
{
this.Disabled = !value;
}
}
the problem is resolved.What is or should be the difference between the properties 'Enabled' and 'Disabled' ?
Regards,
M. Blume