LinkButton behaviour

E

Erik Cruz

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
 
C

Calvin Luttrell/ProjectThunder.com

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top