Results 1 to 4 of 4

Thread: html and asp.net

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2007
    Posts
    308

    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")
    Last edited by tarik666; May 11th, 2008 at 02:52 PM.

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538

    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>

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  3. #3
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    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
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width