Prev: Pass changing values to parameter to Crystal Report scroll thru re
Next: Need Help Using A Custom Session Manager
From: JohnE on 1 Apr 2010 00:08 Hello. I have an asp:Button that in the click event I would like to have it run a javascript function (function ProteusListPrint()). I currently have the following in the click event; btnProteusListPrint.Attributes.Add("onclick", "ProteusListPrint()"); This is not working. Am I missing something or is this not the correct way to reference it in the click event of the button (C#)? Thanks... John
From: Mr. Arnold on 1 Apr 2010 00:19 JohnE wrote: > Hello. I have an asp:Button that in the click event I would like to have it > run a javascript function (function ProteusListPrint()). I currently have > the following in the click event; > > btnProteusListPrint.Attributes.Add("onclick", "ProteusListPrint()"); > > This is not working. Am I missing something or is this not the correct way > to reference it in the click event of the button (C#)? > > Thanks... John > > You have server side onclick. And you have client side onclick that works on the client side where you can access javascript on the client side. Are you using the right onclick?
From: Alexey Smirnov on 1 Apr 2010 04:14 On Apr 1, 6:08 am, JohnE <Jo...(a)discussions.microsoft.com> wrote: > Hello. I have an asp:Button that in the click event I would like to have it > run a javascript function (function ProteusListPrint()). I currently have > the following in the click event; > > btnProteusListPrint.Attributes.Add("onclick", "ProteusListPrint()"); > > This is not working. Am I missing something or is this not the correct way > to reference it in the click event of the button (C#)? > > Thanks... John Your code looks correct. You need to check if ProteusListPrint() is working properly. Try to add, for example, alert("started"); .... code alert("ended"); to see that it is really executed. Hope this helps
From: Andrew Morton on 1 Apr 2010 03:57 JohnE wrote: > Hello. I have an asp:Button that in the click event I would like to > have it run a javascript function (function ProteusListPrint()). I > currently have the following in the click event; > > btnProteusListPrint.Attributes.Add("onclick", "ProteusListPrint()"); > > This is not working. Am I missing something or is this not the > correct way to reference it in the click event of the button (C#)? You want to add it /before/ the user clicks the button, for example in the Page_Load event (check If !Page.IsPostBack as you only want to add it once). Just look at the rendered HTML in the browser to be sure it has been added the way you intend. Andrew
From: Andy O'Neill on 1 Apr 2010 05:47 "Alexey Smirnov" <alexey.smirnov(a)gmail.com> wrote in message news:c6d6bbe7-0e5b-4a57-aa98-a27d079d5061(a)33g2000yqj.googlegroups.com... >Your code looks correct. You need to check if ProteusListPrint() is >working properly. Try to add, for example, I concur. The problem is that the javascript isn't working for whatever reason. That "Attributes.Add" injects javascript which will run on the client.
|
Next
|
Last
Pages: 1 2 3 Prev: Pass changing values to parameter to Crystal Report scroll thru re Next: Need Help Using A Custom Session Manager |