changing "enabled" value of a button during runtime in flex
- by ruchir patwa
i want to make a button disabled if a datagrid is empty and it should be enabled when there is atleast 1 entry.the entries in the grid are made at runtime.I tried this
this is the button:
<mx:Button id="update" label="Update Contact" enabled="{isButtonEnabled()}"/>
and the function is defined as where dg_contact is the datagrid:
public function isButtonEnabled():Boolean
{
if(dg_contact.selectedIndex==-1)
{
return false;
}
else
{
return true;
}
}
where am i going wrong?