This isn't exactly the best way to do things in ASP.Net. Dynamic controls have many gotchas, and you just found one of them. This code is a little better (make sure the page calls DataBind() at some point):
<%for (int i=0;i<5;i++)
{%>
<asp:LinkButton id="<%# i%>" runat="server" text="<%#i%>" />
<%}%>
but you'll find that events and changes don't wire up the way you'd expect them to, if it works at all. With only five of them, it's better to just list them out by hand, and things will be much easier down the road. Or, if they came from a datasource somewhere use a repeater and create them that way.
Really, you don't want to mix code into your aspx markup at all if you can help it. Leave it for the code behind!