Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Added a asp:LinkButton control to traverse to redirected page, but not working on onClick event.
Plz Help me out.
Code goes here...
XML
<asp:LinkButton ID="lnkLogin" runat= "server" Text="[Login]"
           Font-Underline="false"  onclick="lnkLogin_Click" ></asp:LinkButton>


code behind page...
C#
public partial class Home : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        lnkLogin.PostBackUrl = Request.Url.AbsoluteUri;
    }
    protected void lnkLogin_Click(object sender, EventArgs e)
    {
        try
        {
            Server.Transfer("FrmLogin.aspx");
        }
        catch
        {

        }
    }
}
Posted
Comments
PS Solutions 21-May-14 10:09am    
Just Delete the try catch

Go to the property of link button
and in events of check double click on button_click event
and check where it is navigating you and write your code there
 
Share this answer
 
use this..

C#
Server.Transfer("FrmLogin.aspx", true);


For more detail visit here.

http://msdn.microsoft.com/en-us/library/540y83hx(v=vs.100).aspx[^]
 
Share this answer
 
can you give me brief description of the error which occurred when clicking the
link button.

for instance try the following:
Make sure the link button is placed inside the
form tag with runat="server" placed in form tag
ie.,

ASP.NET
<form name="xyz"  runat="server">
<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">Logout</asp:LinkButton>
</form>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900