Hi,
As ThePhantomUpvoter said, you should try to do this with JavaScript, not with C#.
Try this:
<form runat="server">
<asp:TextBox runat="server" BackColor="Red" ID="textbox1" />
<asp:TextBox runat="server" BackColor="Green" ID="textbox2" />
<asp:textbox runat="server" BackColor="Blue" ID="textbox3" />
</form>
<script type="text/javascript">
var txtbox1 = document.getElementById("<%=textbox1.ClientID%>");
var txtbox2 = document.getElementById("<%=textbox2.ClientID%>");
var txtbox3 = document.getElementById("<%=textbox3.ClientID%>");
setInterval(function () {
prevColorTxt1 = txtbox1.style.backgroundColor;
prevColorTxt2 = txtbox2.style.backgroundColor;
prevColorTxt3 = txtbox3.style.backgroundColor;
txtbox2.style.backgroundColor = prevColorTxt1;
txtbox3.style.backgroundColor = prevColorTxt2;
txtbox1.style.backgroundColor = prevColorTxt3;
}, 5000, null);
</script>
More about the
setInterval
function:
https://developer.mozilla.org/en-US/docs/Web/API/window.setInterval[
^]
Hope this helps.