Basic MVC Plumbing

  1. #1

    Basic MVC Plumbing

    We are wanting to use Ext.Net.MVC with version 2.0 but having some issues getting the MVC examples to work under 2.0.

    The example we are looking at is in Dashboard.aspx with the JsonResult coming from DataController.cs. The controller gets called but the Store does not populate the Panel. Possibly I am not wiring the Store up with the Json that is coming back if it is coming back at all.

    I would appreciate any input on the following code:

    Here is the Store:
    <Store>
                        <ext:Store ID="Store1" runat="server" AutoLoad="true">
                            <Proxy>
                                <ext:AjaxProxy Url="/Data/GetHomeSchema/" AutoDataBind="true" Json="true" >
                                    <ActionMethods Read="POST" />
                                    <Reader>
                                        <ext:JsonReader Root="data">
                                           
                                        </ext:JsonReader>
                                    </Reader>
                                </ext:AjaxProxy>
                            </Proxy>
                            <Model>
                                 <ext:Model ID="Model1"  runat="server" AutoDataBind="true" >
                                     <Fields>
                                        <ext:ModelField Name="Title" />
                                        <ext:ModelField Name="Items" />
                                     </Fields>
                                 </ext:Model>
                             </Model>
                        </ext:Store>
                    </Store>

    Here is the Controller Code
    public JsonResult GetHomeSchema()
            {
                XElement document = XElement.Load(Server.MapPath("~/resources/images/HomeSchema.xml"));
                var defaultIcon = document.Attribute("defaultIcon") != null ? document.Attribute("defaultIcon").Value : "";
                var query = from g in document.Elements("group")
                            select new
                            {
                                Title = g.Attribute("title") != null ? g.Attribute("title").Value : "",
                                Items = (from i in g.Elements("item")
                                         select new
                                         {
                                             Title = i.Element("title") != null ? i.Element("title").Value : "",
                                             Icon = i.Element("item-icon") != null ? i.Element("item-icon").Value : defaultIcon,
                                             Accordion = i.Element("accordion-item") != null ? i.Element("accordion-item").Value : "",
                                             MenuItem = i.Element("menu-item") != null ? i.Element("menu-item").Value : ""
                                         }
                                         )
                            };
    
                return Json(query.ToArray(), JsonRequestBehavior.AllowGet);
            }
  2. #2
    Why do you set Root="data"? Can you show response from the server (you can get it from Fiddler or Firebug) ?
    I guess the issue is related with mismatch of model (root and field names) and response
  3. #3
    Thank you Vladimir for your very quick response.

    I was setting Root=?data? to match the mvc examples that I saw but I am not sure exactly what I should set this to. Also, I have been playing around with Fire Bug and Fiddler checking to see if the data comes back to the page but I am not quite sure how to determine if it has come back but I will play around with this more.

    Basically I am just trying to get the Dashboard.aspx in the MVC examples to work under version 2.0 and maybe one data grid. If we have that I am certain we are going to go with Ext.Net; it?s such a great framework and the MVC is very compelling.

    Thank you for any additional input you have on the markup.

    Patrick
  4. #4

    Update: Its working.

    Well, I have got it partially working, there were some changes I made within the <Tpl runat="server"> tag. Ext.Net is cool stuff!

    Thank you again Vladimir.

Similar Threads

  1. Ext.Net 2.0 Calendar-Basic sample not working IE9
    By xtremexploit in forum 2.x Help
    Replies: 1
    Last Post: Mar 29, 2012, 8:05 PM
  2. [CLOSED] Calendar basic requirements?
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Sep 12, 2011, 9:28 AM
  3. Error in example PropertyGrid > Basic > Overview
    By george.paoli in forum Bugs
    Replies: 1
    Last Post: Nov 17, 2010, 9:05 PM
  4. Element\Basic\Layer Error
    By Fabrizio in forum 1.x Help
    Replies: 1
    Last Post: Jul 13, 2010, 5:06 PM
  5. Getting Started Basic Example
    By tarekahf in forum 1.x Help
    Replies: 3
    Last Post: Nov 09, 2009, 1:17 AM

Tags for this Thread

Posting Permissions