LinkButton behaviour

Discussion in 'ASP .Net Web Controls' started by Erik Cruz, May 23, 2004.

  1. Erik Cruz

    Erik Cruz Guest

    Hi.

    By an accident, I found a strange behaviour from Linkbuttons I could not
    understand. I put a Linkbutton inside a Repeater. For this Linkbutton I
    created an onClick event, this way:

    <asp:linkbutton id="lnkUpdate" onClick="RunUpdate"></asp:linkbutton>

    The RunUpdate routine is in my code-behind file. When I click the Linkbutton
    it runs the code on the server. Shouldn't it run a client script routine? I
    noticed that a Linkbutton does not show a onServerClick event, so, onClick
    will run on both server and client sides?

    TIA,
    Erik Cruz
     
    Erik Cruz, May 23, 2004
    #1
    1. Advertising

  2. Erik,

    Try giving your Linkbutton a command name then if it is in your repeater is should fire this event. For client code to run you can use the Attrubites Property of the Link Button to add the JavaScript or whatever client script. I don't know about doing both. You may have to disable the autopostback on that control. You'll have to test it.

    -Calvin Luttrell
    ProjectThunder.com


    LinkButton1.Attributes.Add("OnClick", "DoSomethingJava;")


    Private Sub Repeater1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles Repeater1.ItemCommand

    If e.CommandName = "GO" Then

    'Go do something, do it now, do it now!

    End If

    End Sub




    > By an accident, I found a strange behaviour from Linkbuttons I could not
    > understand. I put a Linkbutton inside a Repeater. For this Linkbutton I
    > created an onClick event, this way:
    >
    > <asp:linkbutton id="lnkUpdate" onClick="RunUpdate"></asp:linkbutton>
    >
    > The RunUpdate routine is in my code-behind file. When I click the Linkbutton
    > it runs the code on the server. Shouldn't it run a client script routine? I
    > noticed that a Linkbutton does not show a onServerClick event, so, onClick
    > will run on both server and client sides?
     
    Calvin Luttrell/ProjectThunder.com, May 24, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fresh Air Rider
    Replies:
    0
    Views:
    546
    Fresh Air Rider
    Mar 2, 2004
  2. John Blair

    asp:linkbutton - commandname behaviour

    John Blair, Dec 30, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    4,961
    John Blair
    Dec 30, 2004
  3. Sathyaish
    Replies:
    3
    Views:
    3,117
    Sathyaish
    Sep 8, 2005
  4. Andy Chambers
    Replies:
    1
    Views:
    392
    Daniel Dyer
    May 14, 2007
  5. Sathyaish

    Linkbutton does not look like a linkbutton

    Sathyaish, Sep 8, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    194
    Sathyaish
    Sep 8, 2005
Loading...

Share This Page