PDA

View Full Version : Ext Js and asp.net



sri_js
4 Aug 2009, 7:24 AM
Hi All,
I have code snipped like this:
in asp ------
JavaScriptSerializer serializer = newJavaScriptSerializer();
try
{
db.clients.InsertOnSubmit(newAccount);
db.SubmitChanges();
var x = new
{
success = true,
data = new { }
};Response.Write(serializer.Serialize(x));
Response.End();
}
catch (Exception ex)
{}
in js-------
buttons: [{
text: 'Save',
handler: function() {
if (tab2.form.isValid()) {
tab2.getForm().submit({
waitMsg: 'In processing',
scope: this,
failure: function(form, action) {
if (action.failureType == 'server') {
obj = Ext.util.JSON.decode(action.response.responseText);
Ext.Msg.alert('Warning!', obj.errors.reason);
} else {
Ext.Msg.alert('Warning!', 'Fail to save data. ' + action.response.responseText);
}
},
success: function(form, action) {
Ext.MessageBox.show({
title: 'Success:',
msg: action.response.responseText,
modal: true,
buttons: Ext.MessageBox.OK,
icon:Ext.Msg.ERROR
});
}
});
}
--------
it is ok except that....when i click save button.....waitMsg never stop. any suggestion to resolve it? thanks.

andycramb
4 Aug 2009, 7:47 AM
Does your form submission hit the asp code?
Have you tried sticking a breakpoint in your asp code to see if it is getting executed?

Best to format your formatted code in code tags. It helps people pick up any issues in your code.

sri_js
4 Aug 2009, 10:04 PM
i'll try to debug this problem. I think at this...
-----------------------------------
var x = new
{
success = true,
data = new { }
};
Response.Write(serializer.Serialize(x));
Response.End();
---------------------------------
'success: true' never sendback to ext js, so my ext js still wait for the result. maybe someone can give me suggestion ?

harley.333
6 Aug 2009, 6:05 AM
At the very least, you need to Response.Clear() before you Response.Write().

MiamiCoder
6 Aug 2009, 2:21 PM
Try reaching your asp.net page with a browser and verify that it outputs what your client code expects.
Attach the debugger to the page and confirm that your request from the client is reaching the page's load event. If it does, you will be able to step through the code and see where it breaks.