Hi Mattias,
No, the code example you were quoting wouldn't work if you had a TextBox in an INamingContainer. We'd like to make some improvements for scenarios like this in the future, but for now there is a workaround available. You can programatically modify the animations on the server like this: <%@ Page Language="C#" %>
<%@ Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
// Set the ConditionScript property of the OnClick Animation
MyAnimations.OnClick.Properties["ConditionScript"] = string.Format("( $('{0}').value == '' )", txtName.ClientID);
// Set the AnimationTarget property of the OnClick Animation's first child
MyAnimations.OnClick.Children[0].Properties["AnimationTarget"] = txtName.ClientID;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server"><title>Test Page</title></head>
<body><form runat="server"><div>
<atlas:ScriptManager id="ScriptManager" runat="server" />
Name: <asp:TextBox ID="txtName" runat="server" /><br />
<asp:Button ID="btnValidate" runat="server" Text="Animate If Empty" OnClientClick="return false;" />
<atlasToolkit:AnimationExtender ID="MyExtender" runat="server">
<atlasToolkit:AnimationProperties ID="MyAnimations" TargetControlID="btnValidate">
<Animations>
<OnClick>
<Condition ConditionScript="/* To be filled in by the server - we'll default to false */ false">
<Color Duration="1" StartValue="#FFFFFF" EndValue="#FF0000"
Property="style" PropertyKey="backgroundColor" />
</Condition>
</OnClick>
</Animations>
</atlasToolkit:AnimationProperties>
</atlasToolkit:AnimationExtender>
</div></form></body>
</html>
Thanks,
Ted
This posting is provided "AS IS" with no warranties, and confers no rights.