Monday, September 7, 2009

Parameter for AjaxOptions OnBegin callback ?

Hello,

I'm using asp.net mvc v 1.0 and wondering how I could write the AjaxOptions block so as to pass a parameter to the OnBegin callback. I write relevant code at bottom.

I tested "Test('hello')" but this prevented the ajax call to correctly update the target area (response opened in a new page).

However, when I look at the arguments passed to the callback, I find some, and just miss the correct documentation page. Could someone point me out to it please ? Argument $4 is the JQuery (it seems) object that will be updated by the ajax call. I can do with it, but will it remain in 4th position ? So I need to grab the correct information.

Here are the callback parameters when looking at it with Firebug :

Object $3=Object $4=tbody#d1.tbody_nav $0=0

Here is my code :

------------

string lien = Ajax.ActionLink(nomAffiche, "Lire",
new
{
(skip some request parameters here)
},
new AjaxOptions {
UpdateTargetId = "d1",
HttpMethod = "post",
LoadingElementId = "chargement_d1",
OnBegin = "Test"
},
(skip some html attributes here)
);

----------

function Test(chaine) {
alert('test' + chaine);
}

-------------

Thanks,

Barbara

View Full Details...............................

No comments:

Post a Comment