Feb 05, 2009, 12:18 PM
AjaxMethod does not return value
Hi,
I have a simple AjaxMethod that returns a string.
i call it from a Gridpanel column,
return the record.data.id it works. What am i missing ? Best Regards
I have a simple AjaxMethod that returns a string.
[AjaxMethod]
public String encryptCool(String val)
{
val = Crypto.Encrypt(val);
string s = System.Web.HttpUtility.UrlEncode(val);
return s;
}
When i debug i can see that the ajaxmethod is called and it encrypts the value s as it should be.i call it from a Gridpanel column,
<ext:Column DataIndex="id" Header="Show Document" Width="50">
<Renderer Fn="ShowDoc" />
</ext:Column>
The js code for function ShowDoc on my page is as follows, problem is variable c returns undefined, when i remove the AjaxMethod encryptCool function andreturn the record.data.id it works. What am i missing ? Best Regards
<script type="text/javascript">
var ShowURL = '<a href="show.aspx?bt={0}&tt={1}&aid={2}"><img hspace="15" border="0" src="../../img/view.gif"/></a>';
var ShowDoc = function(value, metadata, record, rowIndex, colIndex, store) {
var a = record.data.bID;
var b = record.data.aID;
var c = Coolite.AjaxMethods.encryptCool(record.data.id); // c comes undefined here, if i remove function i get the id correctly eithout encyrption
return String.format(ShowURL, a, b, c);
}
</script>