PDA

View Full Version : I need help about ExtJS + MVC + ASP.NET



ets
30 Jun 2009, 6:46 AM
I need help about ExtJS + MVC + ASP.NET

Hi All

I read several posts and I am very interested about using Ext MVC and ASP.NET.


I have doubt about MVC and ExtJS because I can't see clearly the VIEW concept with javascript UI in the front.

(All Ext Library download to client side with my index.aspx page at once)

Can anybody help me to understand this ?

Can somebody show me how you use the combination on ExtJS + MVC + ASP.NET and take advantages from all technologist?

Thanks in advanced
Daniel

evant
30 Jun 2009, 6:48 AM
http://extjs.com/forum/showthread.php?t=72245

mohaaron
30 Jun 2009, 9:26 AM
You can also try what I've been doing. I've been calling my action methods and having them return ContentResult as pure json which works great and is very simple.

Here is an example of my controller code calling my data layer.


public ContentResult GetEntities()
{
var results = ServiceManager.GetEntityManager().GetEntities();

string jresult = "{" + (char)(34) + "totalRows" + (char)(34) + ":" + results.Count() + "," + (char)(34) + "rows" + (char)(34) + ":" + JsonConvert.SerializeObject(results) + "}";

return this.Content(jresult);
}
You can then call the action method like this with a JsonStore.


var store = new Ext.data.JsonStore({
url: '/Controller/Action',
id: 'PK',
root: 'rows',
fields: ['Field1', 'Field2']
});
Then use the store data however you want.