I’m trying to use a click handler. My function is as so (these are both in the same class):
[DirectMethod]
protected bool Save()
{
//do work
}
and I attempted to call it with:
using (Ext.Net.Button yes = new Ext.Net.Button())
{
// random set up for button
// failed because it couldn't find namespace
yes.Listeners.Click.Handler = "Namespace.Class.Save();";
// attempt 2: removed the first one and assumed that the [DirectMethod] sets
// it to be Ext.net.DirectMethods.Save();
yes.Listeners.Click.Handler = "Ext.net.DirectMethods.Save();"
}
First failed unable to locate namespace, second failed because “object doesn’t support this property or method.”
What string do I use to render this? If not by the Listeners.Click.Handler way, how else can I do it?
The function is in a custom control that extends Ext.Net.Window and the using item is in a function called Display() that renders the control.
Per vladsch’s response, I have changed it to:
[DirectMethod(Namespace="MyMethods")]
public bool Save()
{
//do work
}
and the handler string is now:
yes.Listeners.Click.Handler = "MyMethods.Save();"
when doing so, I get “‘MyMethods’ is undefined.”
Ext.NET forum post by Daniil
Using X.GetCmp I was able to retrieve the data. It probably isn’t the best way possible (probably a way without postback), but it at least netted the results I needed.