Rank: Advanced Member Groups: Member
Joined: 1/9/2009 Posts: 97
|
Hello, I have a Button thats has a command argument of "TEST" and it triggers a callback. I have a JS functions that I would like to run after the callback has updated. The JS Function needs to know which Button and what the arugment was. The following is a sample of my JS Code functions
Code: JavaScript
function AfterUpdate(callback)
{
//Figure out which command it is
var command;
var evtTarget = callback.getEventTarget();
var evtArgument = callback.getEventArgument();
alert(evtTarget);
alert(evtArgument);
}
i get the evtTarget as it shoulw be 'btnNext' but thew evtArgument comes back blank. Why is this?
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
That is normal. :) callback.getEventArgument returns the same value as the second argument that was passed to GetPostBackEventReference (Either on Page object or ClientScriptManager object). In fact almost none of the standard ASP.NET control uses this second parameter. The function was there so that both eventTarget and eventArgument are "covered", but it has little practical use because eventArgument is rarely used. In any case this is not the same as the regular CommandArgument that you see on lot of controls.
CommandArgument that you see/set on a Button control or any other control is saved in view state but not passed along with eventTarget as a separate value because eventTarget alone is sufficient to identify the Button and from the Button you would have CommandArgument --- obviously this is only true on the server side.
On the client side if you wish to have this value, you will have to pass it somehow. The CallbackPanel allows you to pass an extraData from your Execute handler to the client side. So you can use that. You can also use a hidden input field to pass it to the client side.
Hope this helps.
Thanks!
|
Rank: Advanced Member Groups: Member
Joined: 1/9/2009 Posts: 97
|
Well im using this to make a Wizard like Step Page/process. SO i need to know which button is clicked either Previous or Next and Which step were they on and/or going to. The Command argument would change based on the tab. What about the ZTriggers command parameter property?
I noticed there not Triggers.FindbyEventTarget which would be nice in case i move triggers around. I will try the Triiger Parameter and see what I can do with that
|