PDA

View Full Version : How to use ExtJs with asp.net



anmol
1 Aug 2012, 7:05 AM
Hi Guys,
I am a asp.net guy and i want to create a website using ExtJs.
Can any one tell me how do i access the controls from the asp.net code behind (server side code).
Can any give me the links which shows how to connect asp.net and ExtJs.

I have already put this subject in this forum but nobody replied so i urge the forum admins to help me out.

Note : I don't want to use Ext.Net

billtricarico
1 Aug 2012, 12:10 PM
I suggest using ASP.NET MVC3 (http://www.asp.net/mvc/mvc3) along with ExtDirectMVC (http://code.google.com/p/ext-direct-mvc/).
I am actively building an intranet site using these.

anmol
1 Aug 2012, 10:28 PM
Hi billtricarico (http://www.sencha.com/forum/member.php?135046-billtricarico),
Can you please share any sample application which uses extJs and asp.net.
It will help not just me but entire .net community which is trying to use ExtJs with asp.net.

Thanks billtricarico (http://www.sencha.com/forum/member.php?135046-billtricarico).

billtricarico
2 Aug 2012, 7:39 AM
anmol,

Have you downloaded the ExtDirect MVC (http://code.google.com/p/ext-direct-mvc/) project? There is an ASP.NET MVC3 demo project in there. That should get you started.

Here is the official thread (http://www.sencha.com/forum/showthread.php?72245-Ext.Direct-for-ASP.NET-MVC)

anmol
6 Aug 2012, 10:46 PM
Hi billtricarico (http://www.sencha.com/forum/member.php?135046-billtricarico),
I cant see any HTML or aspx page in the given sample.

billtricarico
7 Aug 2012, 8:15 AM
In the download is an Mvc3Demo solution. See attached screenshot. Everything you need to get started is in this sample project.


37798

anmol
15 Aug 2012, 11:27 AM
which page i should set as 'run-as' page.
what are csHTML files.

billtricarico
15 Aug 2012, 11:50 AM
ASP MVC3 does not really use the "Set As Start Page" like classic ASP does, but you can force it to the Index.cshtml file I suppose.

Check the Global.asax.cs file to see how the view routes are set up. It will say that the "Default" route name points to the "Home" controller with the action "Index". That means there is a controller class in the Controllers folder called HomeController. That class has an action method called "Index". That means there is a View called "Index", in the "Home" folder, which is in the Views folder.

So when you point your browser to http://localhost, it will, by default, look for the Index.cshtml file

anmol
20 Aug 2012, 1:41 AM
Hi billtricarico (http://www.sencha.com/forum/member.php?135046-billtricarico),
Thanks a lot for your help,
but i am still not clear about many things.
Consider an example i have 'html' page which accepts the employee information,
That HTML page have some textboxes which accept the information of employee,
at last there is a 'Save' button, when i click this save button i want to pass the employee information as an object to the server side (may be webservice function) and it will be saved there.
How do i do this ?

Thanks in advance !

billtricarico
20 Aug 2012, 3:50 PM
The way you are describing it, you are not using any ExtJS components. You should have a basic ExtJS application in place which is launched from your HTML file. In your ExtJS app, you would have a FormPanel or something similar to accept the employee information. You would create an event handler for your ExtJS submit button, which would call an ExtDirect method that the ASP.NET MVC3 Controller will receive as a JSON object.

anmol
23 Aug 2012, 8:52 AM
I will tell you what i have done so far,
I have created a HTML page which will send a object of Employee class to the server side, my server side is the WCF service.
So in short i am calling the WCF service method from ExtJs code.
I have already created a webInvoke method at WCF service which will save the Employee data but how do i call this method from ExtJs. How do i pass the employee class object to WCF service ?
Can you just give me the code snippet.

anmol
23 Aug 2012, 9:49 AM
I am not using asp.net MVC3.
and Ext.Direct means RPC (Remoting) so does Ext Direct should be used in case of the WCF service and ExtJs interfacing ?