Problem with GMapPanel in MVC2 using PartialViewResult

  1. #1

    Problem with GMapPanel in MVC2 using PartialViewResult

    Hi

    I tried to integrate a ux:GMapPanel using the partialviewresult in MVC2 and it didn't work. Doing the same in a page it works but in a control redered trough the partialviewresult it doesn't.

    web.config
     
    <add tagPrefix="ux" namespace="Ext.Net.UX" assembly="Ext.Net.UX"/>
    Controller-Action
     
    public ActionResult Map()
    {
    Ext.Net.MVC.PartialViewResult myPartialViewResult = new Ext.Net.MVC.PartialViewResult();
    myPartialViewResult.ViewData.Model = ViewModelFactory.CreateBaseViewModel<HomeViewModel>();
    myPartialViewResult.RenderMode = RenderMode.RenderTo;
    myPartialViewResult.WrapByScriptTag = false;
    return myPartialViewResult;
    }
    View
     
    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BPM.MVC.Web.ViewModels.HomeViewModel>" %>
    <ext:ResourceManagerProxy runat="server" />
    <script runat="server">
    protected override void OnInit(EventArgs e)
    {
    base.OnInit(e);
    // Center window on browser resize
    if (Request.UserAgent.ToLower().IndexOf("iphone") < 0)
    this.myMapWindow.Listeners.Render.Handler = "Ext.EventManager.onWindowResize(function(){this.center();}, this);";
    }
    </script>
    <ext:Window ID="myMapWindow" 
    runat="server" 
    Collapsible="false" 
    Maximizable="false"
    Icon="Bug" 
    Title="Report a Defect" 
    Width="500" 
    Height="300" 
    Resizable="false"
    CenterOnLoad="true" 
    Layout="Fit" 
    CloseAction="Close">
    <Items>
    <ux:GMapPanel ID="GMapPanel1" runat="server" GMapType="Panorama">
    <CenterMarker lat="42.345573" lng="-71.098326" />
    </ux:GMapPanel>
    </Items>
    </ext:Window>
  2. #2
    I got it work but I have still a few questions:

    - How can I substitude the script tag below using ext.net syntax?
    - Why must the APIBaseUrl Attribute empty?

    Cheers

    Default.Master

     
    <script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=ABQIAAAA2CKu_qQN-JHtlfQ5L7BLlRT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQl3I3p2yrGARYK4f4bkjp9NHpm5w" type="text/javascript"></script>

    View

     
     
    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BPM.MVC.Web.ViewModels.HomeViewModel>" %>
    <script runat="server">
    protected override void OnInit(EventArgs e)
    {
    base.OnInit(e);
    // Center window on browser resize
    if (Request.UserAgent.ToLower().IndexOf("iphone") < 0)
    this.myMapWindow.Listeners.Render.Handler = "Ext.EventManager.onWindowResize(function(){this.center();}, this);";
    }
    </script>
    <ext:Window ID="myMapWindow" 
    runat="server" 
    Collapsible="false" 
    Maximizable="false"
    Icon="Map" 
    Title="Map" 
    Width="800" 
    Height="600" 
    Resizable="false"
    CenterOnLoad="true" 
    Layout="Fit" 
    CloseAction="Close">
    <Items>
    <ux:GMapPanel runat="server" ZoomLevel="13" GMapType="Map" APIBaseUrl="">
    <CenterMarker lat="47.452339" lng="8.562512" />
    </ux:GMapPanel>
    </Items>
    </ext:Window>
  3. #3
    Hi,

    GMap plugin requires Google MAP libarary. Normally, that library attached automatically using
    ResourceManager.RegisterClientScriptInclude
    Unfortunately, that method doesn't work during the partial rendering
    Therefore you have to attach google map engine manually
    <head id="Head1" runat="server">
        <title>Ext.NET</title>
        
        <ext:ResourcePlaceHolder runat="server" Mode="ScriptFiles" />
        
        <script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=ABQIAAAA2CKu_qQN-JHtlfQ5L7BLlRT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQl3I3p2yrGARYK4f4bkjp9NHpm5w" type="text/javascript"></script>
    </head>
    Please note that you have to register own APIKey because default API key for localhost only
    http://www.google.com/uds/solutions/...mapsearch.html

    - Why must the APIBaseUrl Attribute empty?
    Please provide more details. I am not sure that clear understood you
  4. #4
    Quote Originally Posted by vladimir View Post
    Hi,

    GMap plugin requires Google MAP libarary. Normally, that library attached automatically using
    ResourceManager.RegisterClientScriptInclude
    Unfortunately, that method doesn't work during the partial rendering
    Therefore you have to attach google map engine manually
    <head id="Head1" runat="server">
        <title>Ext.NET</title>
     
        <ext:ResourcePlaceHolder runat="server" Mode="ScriptFiles" />
     
        <script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=ABQIAAAA2CKu_qQN-JHtlfQ5L7BLlRT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQl3I3p2yrGARYK4f4bkjp9NHpm5w" type="text/javascript"></script>
    </head>
    Please note that you have to register own APIKey because default API key for localhost only
    http://www.google.com/uds/solutions/...mapsearch.html

    Please provide more details. I am not sure that clear understood you
    1. Thank you very much for your explanation, but I ran in to new questions...

    - What does the attribute Mode="ScriptFiles" affect?
    - Isn't there any way to tell the ResourcePlaceHolder to load the scriptressources?

    2. In IE the Map shows correctly. But working with FF the Map-Window is showing up shortly (1/2s) and then a white page shows up loading forever.. Now if I define APIBaseUrl="" this doesnt happen...

    Thank you
  5. #5
    Hi,

    - What does the attribute Mode="ScriptFiles" affect?
    ResourcePlaceholder with Mode="ScriptFiles" renders resource (js files) at that place. Init script (creating control) will be added to the end of the header.

    - Isn't there any way to tell the ResourcePlaceHolder to load the scriptressources?
    All resources are registered automatically, just Google Map library is external library therefore it is registered via ResourceManager.RegisterClientScriptInclude which doesn't work during partial rendering (therefore you have to attach google map library manually)


    In IE the Map shows correctly. But working with FF the Map-Window is showing up shortly (1/2s) and then a white page shows up loading forever.. Now if I define APIBaseUrl="" this doesnt happen...
    I cannot reproduce such effects. APIBaseUrl should not affect on this because it doesn't rendering during partial rendering. Can you provide full test sample which demonstrates it
  6. #6
    Hi tiramisu,

    Could you provide the sample code that Vladimir mentioned? Or, maybe, should this thread be marked as solved?
  7. #7
    That takes some time to extract the mvc from the n-tired project.
  8. #8

    Ext.Net Control in MVC2

    Hi Guys

    I'm using ASP.NET MVC2 to deploy our project. Recently, I have known about Ext.Net and I'm very interest in conbining Ext.net with MVC2 to our project. However I can't add ext.net control into Views. So can you please give me an examble of that?

    Thanks and apprecia
  9. #9
    Hi,

    For the future, please start a new forum thread for a new question.

    Regarding the question.

    Here are online examples.
    http://mvc.ext.net/

    Here is source code
    http://code.google.com/p/extnet-mvc/
    Last edited by Daniil; Nov 25, 2010 at 7:13 AM.

Similar Threads

  1. [CLOSED] Problem with MVC2 / .NET Framework 4.0
    By Stefanaccio in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Nov 25, 2011, 7:16 AM
  2. how to implement Ext.net in MVC2 asp.et
    By hardik in forum 1.x Help
    Replies: 3
    Last Post: Sep 30, 2011, 11:06 AM
  3. [CLOSED] Universal PartialViewResult Problem
    By tiramisu in forum 1.x Legacy Premium Help
    Replies: 11
    Last Post: Dec 28, 2010, 1:27 PM
  4. [CLOSED] Refresh problem with PartialViewResult
    By Stefanaccio in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 02, 2010, 6:19 AM
  5. [CLOSED] PartialViewResult Problem
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jan 27, 2010, 11:15 AM

Posting Permissions