-
html and asp.net
Hey guys I am trying to use a html anchor tag with asp.net
here is the code
Code:
Protected Sub linkadd_ServerClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles linkadd.ServerClick
Session("adduser") = "true"
MsgBox(Session("adduser"))
End Sub
Here is my html
<li><a href="ChangeUser.aspx" id="linkadd" runat=server>Add User</a></li>
When I run the page it is running the error
do post back is not defined
javascript dopastback("linkadd")
-
Re: html and asp.net
There's an ASP.Net specific serverside control named LinkButton which you'll want to use:
Code:
<li><asp:linkbutton id="linkadd" runat="server"
href="ChangeUser.aspx">Add User</asp:linkbutton></li>
-
Re: html and asp.net
I would suggest against using a Post Back for a hyperlink. Postbacks are typically synonymous with a button where as hyperlinks typically take you somewhere else.
Sorry, just trying to rid the world of evil one post back at a time :)
-
Re: html and asp.net
If you have the location defined - changeuser.aspx - then you don't need to perform your postback. If you need to pass other info to the next page, consider appending that in the querystring if it's not sensitive information.