<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="true" OnTextChanged="Click"></asp:TextBox>
Javascript: <script type="text/javascript" language="javascript">
function validate(msg) {
var text1 = document.getElementById("divtext");
if (msg == "y")
{
text1.style.color = 'Green';
}
else
{
text1.style.color = 'Red';
}
}
</script>
Code Behind protected void Click(object sender, EventArgs e)
{
string msg = TextBox1.Text.Trim();
string fun = "validate('" + msg + "')";
ScriptManager.RegisterStartupScript(Page, typeof(Page), "Validate", fun, true);
}
Thanks & Regards