开发者

anchor tag inside a repeater with runat = "server" acting strange

开发者 https://www.devze.com 2022-12-14 03:57 出处:网络
I have following code inside my asp.net repeater inside itemtemplate. <a runat = \"server\" href = \"StoreCategory/testing.aspx\">dsdsdsd</a>

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 r开发者_Go百科unat = "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.


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>


Hai progtick,

Have a look at this it would help you Is Adding runat="server" to HTML tags to get relative path in ASP.net an elegant solution?

0

精彩评论

暂无评论...
验证码 换一张
取 消