Asp – anchor tag inside a repeater with runat = “server” acting strange

asp.net

I have following code inside my asp.net repeater inside itemtemplate.

<a runat = "server" href = "StoreCategory/testing.aspx">dsdsdsd</a>

Now, I would think that this link would point to mydomain.com/StoreCategory/testing.aspx (which it does if runat = "server" is not in there)

However, if I keep runat = "server" there, the link turns out to be mydomain.com/testing.aspx. It drops StoreCategory! Why do you think it is doing that?

I figured out part of the problem, the reason is the current page is StoreCategory.aspx. However, why only runat = "server" is getting confused and how to tell it not to get confused is beyond me, hmm.

Best Answer

Hai,

Have you tried using asp:linkbutton with postbackUrl property

Use

<asp:LinkButton ID="lb" runat="server"  PostBackUrl="StoreCategory/testing.aspx" Text="dsdsdsd"></asp:LinkButton>
Related Topic