PDA

View Full Version : How to read parameters of ExtJS Form on ASP.NET page



Shehul
20 Apr 2012, 6:04 AM
Hello,

I am trying to create ExtJS form and have submit button which when clicked should post to ASP.NET webpage.

Inside asp.net page I am trying to process the parameters received. I am not sure how I can read those parameters(form values) on server side.

Here is my code,

form.submit(
{
clientValidation : true,
url : 'Feedback.aspx',
params:{Para1:'Id',Para2:"email"},
waitMsg:'Saving...',
success : function(form, action)
{
Ext.Msg.show(
{
title : 'Success'
, msg : 'Feedback submitted successfully'
, modal : true
, icon : Ext.Msg.INFO
, buttons : Ext.Msg.OK
}
);
}
,
failure : function(form, action)
{
this.showError(action.result.error || action.response.responseText);
}

I am hitting breakpoint on Server's Page Load but not sure how to read parameter values.

Please reply if this is not correct way do I need to create webmethod and if yes than please point me to an example to read this parameters in the webmethod.

Please reply ASAP.

Thanks,
Shehul

gurufaction
20 Apr 2012, 6:12 AM
In ASP.NET use the Request object's Form property.



Request.Form["MyVarName"]

Shehul
20 Apr 2012, 6:29 AM
Hi gurufaction (http://www.sencha.com/forum/member.php?76220-gurufaction),

Thanks for the reply. I will mark your answer but quick question now, how do I reply to the ExtJS form back that form is submitted successfully or get error.

I am using Response.write but the Reply is not JSON.

Thanks,

gurufaction
20 Apr 2012, 6:53 AM
In what format is your reply?

Shehul
20 Apr 2012, 6:56 AM
Its XML.

gurufaction
20 Apr 2012, 7:26 AM
Define an XML reader on your proxy.



var store = Ext.create (http://www.sencha.com/forum/#!/api/Ext-method-create)('Ext.data.Store (http://www.sencha.com/forum/#!/api/Ext.data.Store)', {
model: 'User',
proxy: {
type: 'ajax',
url : 'users.xml',
reader: {
type: 'xml',
record: 'user'
}
}
});

Shehul
20 Apr 2012, 7:30 AM
Sorry but than how the Form Result function will work because from what I understood unless we supply "Success" or "Failure" to success : function(form, action) the function doesn't allow any processing.

I am now thinking to change my response to JSON ,can you reply what should be my JSON reply.

Thanks,
Shehul


Define an XML reader on your proxy.



var store = Ext.create (http://www.sencha.com/forum/#!/api/Ext-method-create)('Ext.data.Store (http://www.sencha.com/forum/#!/api/Ext.data.Store)', {
model: 'User',
proxy: {
type: 'ajax',
url : 'users.xml',
reader: {
type: 'xml',
record: 'user'
}
}
});

gurufaction
20 Apr 2012, 7:56 AM
The success property on your result is optional. If you return an HttpStatusCode of 200 then your success callback will be called.

Shehul
20 Apr 2012, 7:59 AM
Hi Gurufaction,

Consider me as a newbie to everything, so can you please reply how to set HttpStatusCode to 200? and what to send in case of error?

Thanks,


The success property on your result is optional. If you return an HttpStatusCode of 200 then your success callback will be called.

gurufaction
20 Apr 2012, 8:11 AM
Any response generated by your ASP.NET code should be status code 200 by default. If you wan't to handle any errors you can format your results to include a success property or just change the http headers on your response.

thilakmsc
4 Jul 2012, 3:19 AM
HOw to read data from ExtJs to asp.net

thilakmsc
4 Jul 2012, 11:40 PM
Dear all .,

Mat i know how to pass value from Ext js control to server side(ASP.Net using AJAX)

Thnak you:(