Apollo0130 Posted March 15, 2005 Posted March 15, 2005 hi @ all, i have a table in a webform and i must create a link in the table, for example with a link button. i am using vb.net and i have created the link button already, but my problem is to create the click event for the button, which can execute the link when the user clicks the button... please help me... :confused: Apollo0130 Quote
kahlua001 Posted March 15, 2005 Posted March 15, 2005 Many ways to do it. I go to the HTML view, and double click on your link button, your codebehind will open up with the genertated click event. Quote
fizzled Posted March 15, 2005 Posted March 15, 2005 Similar problem I just want to attach a server-side click event to a link on my page, outside of a form. However, the following code simply generates an error when I click the link. I don't have VS.NET, just DWMX. I'm not doing code-behind. <%@ Page Language="C#" Debug="True" ContentType="text/html" ResponseEncoding="iso-8859-1" %> <script runat="server"> public void Page_Load (Object Sender, EventArgs e) { lblWelcome.Text = "Welcome " + Session.Contents["Username"] + ". Your User Level is [" + Session.Contents["UserLevel"] + "]."; } public void lnkLogout_Click (Object Sender, EventArgs e) { Session.Contents.RemoveAll(); Response.Redirect("index.aspx"); } </script> <html> <head> <title>GuildRoster Admin</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <div align="center"> <table border="0" cellspacing="0" cellpadding="0" width="800"> <tr> <td width="380"> <ASP:Label ID="lblWelcome" Text="" RunAt="server" /></td> <td width="40" nowrap></td> <td width="380" align="right"><a href="#" ID="lnkLogout" onServerClick="lnkLogout_Click" runAt="server">Logout</a></td> </tr> </table> </div> </body> </html> Quote
kahlua001 Posted March 15, 2005 Posted March 15, 2005 What error are you getting? I believe you need to put that clickable control in a asp.net form Quote
fizzled Posted March 15, 2005 Posted March 15, 2005 Its a javascript error saying object expected. I'd rather not use up my one web form per page on a simple logout link... Quote
kahlua001 Posted March 15, 2005 Posted March 15, 2005 Is there a problem with enclosing that logout link in your web form? If so, then you can make a separate logout page that handles this operation. Quote
fizzled Posted March 15, 2005 Posted March 15, 2005 I suppose that's what I'll do (make a separate page). Just seems like an unnecessary extra step. Thanks for the responses, kahlua. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.