[OPEN] [#271] How to handle IDMode in PartialViews?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [OPEN] [#271] How to handle IDMode in PartialViews?

    Hi,

    We are using partial views and we are setting ID's on the page controls. We are facing the infamous multiple ID issue. I'm submitting an code example on our scenario. We use IDMode.Parent in the resource manager; When we render the partial view the button disappears from the main view and the partial view button is rendered.

    Main View: Index.cshtml
    @{
        ViewBag.Title = "Index";
    }
    <h2>Main View</h2>
    @using Ext.Net;
    @using Ext.Net.MVC;
    
    @Html.X().ResourceManager().IDMode(IDMode.Parent)
    @Html.X().Button().ID("btnPartial").Text("btnPartial")
    @Html.X().Panel().ID("tPanel").Layout(LayoutType.Fit).Region(Region.Center).Items().Loader(Html.X().ComponentLoader().Url("Test/PartialView1")
                .Mode(LoadMode.Script)
                .LoadMask(lm => lm.ShowMask = true)
                .Params(para =>
                    {
                        para.Add(new { containerId = "tPanel" });
                    }
    
                ))
    Partial View: PartialView1.cshtml
    @using Ext.Net;
    @using Ext.Net.MVC;
    
    @(Html.X().Panel().ID("pnlSub").Height(400).Width(400).Layout(LayoutType.Form).Items(Html.X().Button().ID("btnPartial").Text("btnPartial")))
    Controller
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    
    namespace Controllers
    {
        public class TestController : Controller
        {
            //
            // GET: /Test/
            public ActionResult Index()
            {
                return View();
            }
            
            public ActionResult PartialView1(string containerId)
            {
                Ext.Net.MVC.PartialViewResult pView = new Ext.Net.MVC.PartialViewResult(containerId, Ext.Net.RenderMode.AddTo);
    
                pView.WrapByScriptTag = false;
                return pView;
            }
    
        }
    }
    We need more information on how to use the IDMode property correctly. Please advise.
    Thanks
    Last edited by Daniil; Jun 10, 2013 at 3:19 PM. Reason: [OPEN] [#271]

Similar Threads

  1. MVC Razor PartialViews with DesktopModuleProxy
    By markusn in forum 2.x Help
    Replies: 1
    Last Post: Nov 04, 2012, 3:27 PM
  2. IDMode in a UserControl
    By David Pelaez in forum 1.x Help
    Replies: 1
    Last Post: Mar 23, 2011, 8:55 PM
  3. Load PartialViews on Panel
    By Dominik in forum 1.x Help
    Replies: 5
    Last Post: Feb 25, 2011, 9:19 AM
  4. [CLOSED] [1.0] MVC PartialViews and Icons
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Feb 19, 2010, 3:35 PM
  5. [CLOSED] [1.0] MVC PartialViews and styles?
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 14
    Last Post: Feb 14, 2010, 4:12 PM

Tags for this Thread

Posting Permissions