0

My codes are

<asp:LinkButton ID="LinkButton1" runat="server" 
 PostBackUrl='<%# String.Format("~/WebForms/AnaEkran_EPDK.aspx?id={0}", Eval("ID")) %>' >
</asp:LinkButton>

and

<a href="~/WebForms/AnaEkran_Bayi.aspx?id=<%# Eval("ID") %>" >.....</a>

and they don't work. On the linkbutton output is a javascript:__doPostBack('LinkButton1', ''), why doesn't id take?

sajanyamaha
  • 3,119
  • 2
  • 26
  • 44
s.esin
  • 299
  • 1
  • 4
  • 10

2 Answers2

0

go for OnClientClick of link button

from code behind put this in page load

LinkButton1.OnClientClick = "window.location = '~/WebForms/AnaEkran_EPDK.aspx?id="+ ID.toString() + "'; return false;"

Or in aspx do this

<asp:LinkButton ID="LinkButton1" runat="server" 
 OnClientClick="goToYourPage();" >
</asp:LinkButton>
sajanyamaha
  • 3,119
  • 2
  • 26
  • 44
  • it works but link look like this http://localhost:18675/WebForms/AnaEkran_EPDK.aspx?id=__Page so where is id? And i don' want to do this on the code behind. – s.esin Dec 12 '12 at 13:59
0

Try adding this attribute to your LinkButton:

 href='<%#"~/WebForms/AnaEkran_Bayi.aspx?id="+Eval("ID")%>'
Brian Driscoll
  • 19,373
  • 3
  • 46
  • 65
Tirumudi
  • 423
  • 1
  • 4
  • 18
  • LinkButton doesn't has a href attribute, when i put this to anchor link still doesn't work. – s.esin Dec 12 '12 at 13:54