Mar 05, 2011, 11:27 AM
Success function in calling Direct Method..help!
Hi...
i want use success function in after calling Direct Method. I have something like this:
<ext:XScript runat="server" ID="scripts">
<script type="text/javascript">
function EmpClick() {
var frm = Ext.getCmp("FormPanel1");
if (frm.isValid()) {
Ext.Net.DirectMethods.UpdateRecA(
{
success: function (result) {
#{FormPanel1}.getForm().updateRecord(#{GridPanel1} .getSelectionModel().getSelected());
},
failure: function (errorMsg) {
Ext.Msg.alert('Failure');
}
});
}
}
</script>
</ext:XScript>
and the following Direct Methods :
[DirectMethod]
public void UpdateRecA()
{
string updateEmployee = "update [dbo].[tbl_Employee] set [FirstName]=' " + test + "' where employeeID = '5'";
SQLHelper spConnectionObject = new SQLHelper();
spConnectionObject.GetExecuteNonQueryByCommand(upd ateEmployee, CommandType.Text);
}
when i run this, I'm getting the error in browser: Ext.Net is undefined
[Break On This Error] Ext.Net.DirectMethods.UpdateRecA ....
And, when I remove success/failure function like this
....
if (frm.isValid()) {
Ext.Net.DirectMethods.UpdateRecA();
}
....
it works fine!
As you see, my goal is when I update record in DB using direct method, then I want on success to update the record in grid using success: function (result) {
#{FormPanel1}.getForm().updateRecord(#{GridPanel1} .getSelectionModel().getSelected());
}
Please, help!
Thank you, ABob
i want use success function in after calling Direct Method. I have something like this:
<ext:XScript runat="server" ID="scripts">
<script type="text/javascript">
function EmpClick() {
var frm = Ext.getCmp("FormPanel1");
if (frm.isValid()) {
Ext.Net.DirectMethods.UpdateRecA(
{
success: function (result) {
#{FormPanel1}.getForm().updateRecord(#{GridPanel1} .getSelectionModel().getSelected());
},
failure: function (errorMsg) {
Ext.Msg.alert('Failure');
}
});
}
}
</script>
</ext:XScript>
and the following Direct Methods :
[DirectMethod]
public void UpdateRecA()
{
string updateEmployee = "update [dbo].[tbl_Employee] set [FirstName]=' " + test + "' where employeeID = '5'";
SQLHelper spConnectionObject = new SQLHelper();
spConnectionObject.GetExecuteNonQueryByCommand(upd ateEmployee, CommandType.Text);
}
when i run this, I'm getting the error in browser: Ext.Net is undefined
[Break On This Error] Ext.Net.DirectMethods.UpdateRecA ....
And, when I remove success/failure function like this
....
if (frm.isValid()) {
Ext.Net.DirectMethods.UpdateRecA();
}
....
it works fine!
As you see, my goal is when I update record in DB using direct method, then I want on success to update the record in grid using success: function (result) {
#{FormPanel1}.getForm().updateRecord(#{GridPanel1} .getSelectionModel().getSelected());
}
Please, help!
Thank you, ABob
Last edited by Aleksa007; Mar 05, 2011 at 11:33 AM.