Nov 08, 2013, 1:09 PM
runtime error: 'Ext.net.DirectMethods' is null or not an object
I upgrade my project from ext.net version 1.0 to version 2.3. my page DocumentListpage.aspx has master page. ext:ResourceManager tag is in master page. DirectMethods is defined in DocumentListpage.aspx. when I run the DocumentListpage and click 'Search' button. it suppose to run DirectMethods, but I got Javascript runtime error: 'Ext.net.DirectMethods' is null or not an object.
Here are partial code in masterpage:
Here are partial code in masterpage:
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<Listeners>
<DocumentReady Handler="fristLoad=true;Ext.getDoc().on('keydown', function (e) {if (e.getKey() == e.ENTER) {DoSearch(#{cmbDocTypes}.getValue());}});" />
</Listeners>
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>
Here are DocumentListpage server side code for search:[DirectMethod]
public void SearchAction(string searchCondition, int docTypeID)
{
try
{
List<DocumentKeywordItem> seachValues = CooliteUIHelper.ParseSearchFormPanelSubmitValues(docTypeID, searchCondition);
this.tabMain.Loader.Url = "DocGridList.aspx";
this.tabMain.Loader.Params.Clear();
this.tabMain.Loader.Params.Add(new Ext.Net.Parameter("doctypeid", docTypeID.ToString()));
this.tabMain.Loader.Params.Add(new Ext.Net.Parameter("isquery", "1"));
foreach (DocumentKeywordItem seachValue in seachValues)
{
if (string.IsNullOrEmpty(seachValue.KeywordValue))
continue;
this.tabMain.Loader.Params.Add(new Ext.Net.Parameter(seachValue.KeywordName, seachValue.KeywordValue));
}
this.tabMain.LoadContent();
}
catch (Exception ex)
{
string strmsg = "Error in DocumentListPage::SearchAction: " + ex.Message;
ErrorLog.WriteErrorLog(strmsg, Application["ErrorFile"].ToString());
}
}
here are patial code in DocumentListPage client side code:function DoSearch(fpanel,id) {
var formval = App['ff'+id].getForm().getValues(true);
SearchForm(formval,id);
}
function SearchForm(formValues, doctypeid) {
Ext.net.DirectMethods.SearchAction(Ext.encode(formValues).toString(), doctypeid, {
success: function(result) {
},
failure: function(msg) {
Ext.Msg.alert('Failure', msg);
},
eventMask: {
showMask: true
}
});
}
<ext:FormPanel ID="Tab1" Frame="true" runat="server" Title="Keywords" Layout="card"
ActiveIndex="0" ButtonAlign="Right" AutoHeight="true">
<Items>
<ext:Panel ID="pnlNull" runat="server" Html="No document type" Border="false" Header="false" />
</Items>
<Buttons>
<ext:Button ID="Button1" runat="server" Text="Search" >
<Listeners>
<Click Handler="DoSearch(#{ff1},#{cmbDocTypes}.getValue());" />
</Listeners>
</ext:Button>
<ext:Button ID="Button2" runat="server" Text="Reset">
<Listeners>
<Click Handler="ResetSearchForm(#{cmbDocTypes}.getValue());" />
</Listeners>
</ext:Button>
</Buttons>
</ext:FormPanel>
Last edited by Holly; Nov 08, 2013 at 1:15 PM.