[CLOSED] How to Render Ext.NET controls on Bootstrap modal popup using PartialViewResult

Page 2 of 4 FirstFirst 1234 LastLast
  1. #11
    Hi Daniil,

    I tried doing the same but, when I click Edit button, the popup does not show, and I see below error.


    [TokenNotUniqueException: Token is not unique
    -------------------
    ID = ExtNetOnReadyBegin
    TagName = anchor
    Match = <#:anchor id='ExtNetOnReadyBegin' />
    ]
    So if it is working for you, it should work for me as well. Can you please share your project as well, so that I can make it working at my end as well.


    Also I do agree that this is not approach that we should follow and I do understand consequences, but I said we are bounded by time, and we are new to Ext.NET too, so using too much right is really not an option for us. Also we dont have too many modal popup's that need to render Ext.NET controls, in fact three in total that need to render controls on popup, rest all of the controls will be in main view.

    So Please upload your project as well, so that I can replicate at my end.

    Thanks,
    Puneet
  2. #12
    Please post a simplified sample demonstrating what you have working so far.

    Your sample must only include the minimum amount of code required to reproduce the problem.

    Please review the Forum Guidelines for tips on posting in the forums.
    Geoffrey McGill
    Founder
  3. #13
    Actually, I read through this thread again, and this scenario is not supported by Ext.NET.

    If you can post a very simplified sample demonstrating the problem, then we might be able to assist, otherwise, this is out of scope of what we can support.
    Geoffrey McGill
    Founder
  4. #14
    Alright you left me with no option but to go with more usage of Ext.NET to render partial on popup. I have taken up this to my client about the problem, and they are ready accommodate estimates accordingly, but now I am trying to load the partial view as given example, but now results are quite weird.

    There are two issues:
    1. I am not sure how to pass the ID of GridPanel model to Url.Action when Row is double clicked.
    2. Results coming out is quite weird when PartialViewResult is loaded into Window. ( I have hard coded the id parameter that is required for the EditDetail action).

    I have uploaded the full working project [EDIT: REMOVED]. Please check and let me know what is the resolution.

    Functionality expected:
    1. Render Partial View as a pop up in front with its content (content may or may not have Ext.NET controls, depending on the requirements) on Row Double click.
    2. On Grid Panel Row right click I have added Context Menu, which further passing the ID from Selected Row to Action to remove the data, and then return to view with updated Model. But seems like the View is not getting updated.

    Thanks,
    Puneet
    Last edited by geoffrey.mcgill; Jun 02, 2016 at 5:54 PM.
  5. #15
    Please simplify your code sample and post in the forums between [CODE] tags.

    We must be able to copy + paste your code sample into a local test project and run without have to make major modifications.

    We do not open .zip files.
    Geoffrey McGill
    Founder
  6. #16
    I have already shared one of the example in zip file, as asked by fabricio. Also we have already purchased ext.net license, and I have posted the same issue in 4.X premium support, but fabricio asked me to continue with this thread. So I believe I can expect this much support from you to that you can download my given example at your end and see the issue. I have no issue in posting code in [CODE] tag, but also please stick to one protocol so that my work is not delayed because of this thing.

    Thanks,
    Puneet
  7. #17
    Hi Puneet,

    We use the Forum Guidelines as the basis for our policies:

    http://forums.ext.net/showthread.php...ing-New-Topics

    As well, the following threads provide forum posting tips:

    http://forums.ext.net/showthread.php...ation-Required
    http://forums.ext.net/showthread.php...d-code-samples

    I have no issue in posting code in [CODE] tag
    Perfect, thank you. We'll test your simplified sample once posted, and we'll provide some feedback.

    I'll move this thread to the Premium Forums.
    Geoffrey McGill
    Founder
  8. #18
    Hi Puneet,

    If you email support@ext.net with your forum username and Customer Number or the Transaction ID from your purchase, we can upgrade your forum account to a Premium Member.
    Geoffrey McGill
    Founder
  9. #19
    Alright here is my code:

    CompanyModel.vb

    
    Imports System.Collections
    Imports System.Collections.Generic
    
    Namespace ExtNETExamples
        Public Class CompanyModel
            Public Property ID() As Integer
                Get
                    Return m_ID
                End Get
                Set
                    m_ID = Value
                End Set
            End Property
            Private m_ID As Integer
            Public Property Name() As String
                Get
                    Return m_Name
                End Get
                Set
                    m_Name = Value
                End Set
            End Property
            Private m_Name As String
            Public Property Price() As Double
                Get
                    Return m_Price
                End Get
                Set
                    m_Price = Value
                End Set
            End Property
            Private m_Price As Double
            Public Property Change() As Double
                Get
                    Return m_Change
                End Get
                Set
                    m_Change = Value
                End Set
            End Property
            Private m_Change As Double
            Public Property PctChange() As Double
                Get
                    Return m_PctChange
                End Get
                Set
                    m_PctChange = Value
                End Set
            End Property
            Private m_PctChange As Double
            Public Property LastChange() As DateTime
                Get
                    Return m_LastChange
                End Get
                Set
                    m_LastChange = Value
                End Set
            End Property
            Private m_LastChange As DateTime
            Public Property companyList As List(Of CompanyModel)
            Public  Function GetAll() As List(Of CompanyModel)
                Dim today As DateTime = DateTime.Today
    
                Return New List(Of CompanyModel)() From {
                    New CompanyModel() With {
                        .ID = 1,
                        .Name = "3m Co",
                        .Price = 71.72,
                        .Change = 0.02,
                        .PctChange = 0.03,
                        .LastChange = today
                    },
                    New CompanyModel() With {
                        .ID = 2,
                        .Name = "Alcoa Inc",
                        .Price = 29.01,
                        .Change = 0.42,
                        .PctChange = 1.47,
                        .LastChange = today
                    },
                    New CompanyModel() With {
                        .ID = 3,
                        .Name = "Altria Group Inc",
                        .Price = 83.81,
                        .Change = 0.28,
                        .PctChange = 0.34,
                        .LastChange = today
                    },
                    New CompanyModel() With {
                       .ID = 4,
                       .Name = "American Express Company",
                       .Price = 52.55,
                       .Change = 0.01,
                       .PctChange = 0.02,
                       .LastChange = today
                    },
                    New CompanyModel() With {
                        .ID = 5,
                        .Name = "American International Group, Inc.",
                        .Price = 64.13,
                        .Change = 0.31,
                        .PctChange = 0.49,
                        .LastChange = today
                    },
                    New CompanyModel() With {
                        .ID = 6,
                        .Name = "AT&T Inc.",
                        .Price = 31.61,
                        .Change = -0.48,
                        .PctChange = -1.54,
                        .LastChange = today
                    }
                }
            End Function
    
            Public Shared Function GetAllCompanies() As IEnumerable(Of CompanyModel)
    	        Dim now As DateTime = DateTime.Now
    
    	        Return New Object() {New CompanyModel() With{.Name="3m Co", .Price=71.72, .Change=0.02, .PctChange=0.03, .LastChange=now},
                    New Object() {"Alcoa Inc", 29.01, 0.42, 1.47, now}, 
                    New Object() {"Altria Group Inc", 83.81, 0.28, 0.34, now}, 
                    New Object() {"American Express Company", 52.55, 0.01, 0.02, now}, 
                    New Object() {"American International Group, Inc.", 64.13, 0.31, 0.49, now}, 
                    New Object() {"AT&T Inc.", 31.61, -0.48, -1.54, now}, _
    		        New Object() {"Boeing Co.", 75.43, 0.53, 0.71, now}, 
                    New Object() {"Caterpillar Inc.", 67.27, 0.92, 1.39, now}, 
                    New Object() {"Citigroup, Inc.", 49.37, 0.02, 0.04, now}, 
                    New Object() {"E.I. du Pont de Nemours and Company", 40.48, 0.51, 1.28, now}, 
                    New Object() {"Exxon Mobil Corp", 68.1, -0.43, -0.64, now}, 
                    New Object() {"General Electric Company", 34.14, -0.08, -0.23, now}, _
    		        New Object() {"General Motors Corporation", 30.27, 1.09, 3.74, now}, 
                    New Object() {"Hewlett-Packard Co.", 36.53, -0.03, -0.08, now}, 
                    New Object() {"Honeywell Intl Inc", 38.77, 0.05, 0.13, now},
                    New Object() {"Intel Corporation", 19.88, 0.31, 1.58, now}, 
                    New Object() {"International Business Machines", 81.41, 0.44, 0.54, now}, 
                    New Object() {"Johnson & Johnson", 64.72, 0.06, 0.09, now}, _
    		        New Object() {"JP Morgan & Chase & Co", 45.73, 0.07, 0.15, now}, 
                    New Object() {"McDonald""s Corporation", 36.76, 0.86, 2.4, now}, 
                    New Object() {"Merck & Co., Inc.", 40.96, 0.41, 1.01, now}, 
                    New Object() {"Microsoft Corporation", 25.84, 0.14, 0.54, now}, 
                    New Object() {"Pfizer Inc", 27.96, 0.4, 1.45, now}, 
                    New Object() {"The Coca-Cola Company", 45.07, 0.26, 0.58, now}, _
    		        New Object() {"The Home Depot, Inc.", 34.64, 0.35, 1.02, now}, 
                    New Object() {"The Procter & Gamble Company", 61.91, 0.01, 0.02, now}, 
                    New Object() {"United Technologies Corporation", 63.26, 0.55, 0.88, now}, 
                    New Object() {"Verizon Communications", 35.57, 0.39, 1.11, now}, 
                    New Object() {"Wal-Mart Stores, Inc.", 45.45, 0.73, 1.63, now}}
            End Function
        End Class
    End Namespace

    HomeController.vb

    Imports System.Web.Mvc
    Imports System.Linq
    Imports ExtNETExamples.ExtNETExamples
    Imports Ext.Net.MVC
    Imports Ext.Net
    
    Namespace Controllers
        Public Class HomeController
            Inherits Controller
    
            ' GET: Home
           Function Index() As ActionResult
                Dim companyModel As New CompanyModel
                companyModel.companyList = companyModel.GetAll()
                Return View(companyModel)
            End Function
            Function EditDetail(id As Integer, containerId As String) As ActionResult
                Dim cmModel As New CompanyModel
                cmModel.companyList = cmModel.GetAll().Where(Function(m) m.ID = id).ToList()
                If(cmModel.companyList IsNot Nothing)
                    For each item In cmModel.companyList
                        cmModel.ID = item.ID
                        cmModel.Name= item.Name
                        cmModel.Price = item.Price
                        cmModel.PctChange = item.PctChange
                        cmModel.LastChange = item.LastChange
                        cmModel.Change = item.Change
                    Next
                    
                End If 
                Dim ret As New Ext.Net.MVC.PartialViewResult()
                ret.ViewName = "_CompanyDetail"
                ret.Model = cmModel   
                ret.ContainerId = containerId      
                ret.RenderMode = RenderMode.InsertTo
    
                Me.GetCmp(Of Window)(containerId).Show()
                Return ret
            End Function
    
            Function RemoveCompany(id As Integer) As ActionResult
                Dim cmModel As New CompanyModel
                cmModel.companyList = cmModel.GetAll().Where(Function(m) m.ID <> id).ToList()
                Return View("Index",cmModel)
            End Function
        End Class
    End Namespace

    Home
    @ModelType ExtNETExamples.ExtNETExamples.CompanyModel
    @Code
    ViewData("Title") = "Index"
    End Code
    @(Html.X().ResourceManager())
    <h2>Index</h2>
    
    <p>
        @Html.ActionLink("Create New", "Create")
    </p>
    @(Html.X().Menu().ID("ContextMenu").Items(
                Html.X().MenuItem().Text("Delete Contact"),
                Html.X().MenuItem().Text("Avery 5164"),
                Html.X().MenuItem().Text("Copy"),
                Html.X().MenuItem().Text("Envelope")
                )
    )
    
    @Html.X().Menu().ID("GirdContextMenu").Items(Html.X().MenuItem().Text("Delete ID").DirectEvents(Sub(ls)
                                                                                                             ls.Click.Confirmation.ConfirmRequest = True
                                                                                                             ls.Click.Confirmation.Message = "Are you sure you want to remove the company?"
                                                                                                             ls.Click.Url = Url.Action("RemoveCompany")
                                                                                                             ls.Click.ExtraParams.Add(New Parameter("id", "#{GirdContextMenu}.param1", mode:=ParameterMode.Raw))
                                                                                                         End Sub))
    
    @(Html.X().GridPanel() _
                            .Title("Editable GridPanel") _
                            .Width(600) _
                            .Height(350) _
                            .ID("indexGrid") _
                            .Store(Html.X().Store() _
                            .ID("Store23") _
                            .Model(Html.X().Model() _
                                .IDProperty("IDs") _
                                .Fields(
                                    New ModelField("ID", ModelFieldType.Int),
                                    New ModelField("Name"),
                                    New ModelField("Price", ModelFieldType.Float),
                                    New ModelField("Change", ModelFieldType.Float),
                                    New ModelField("PctChange", ModelFieldType.Float),
                                    New ModelField("LastChange", ModelFieldType.Date)
                                )
                            ) _
                            .DataSource(Model.companyList)
                            ) _
                            .ColumnModel(
                            Html.X().Column().Text("ID").DataIndex("ID").Width(35),
                            Html.X().Column() _
                                .Text("Name") _
                                .DataIndex("Name") _
                                .Flex(1),
                            Html.X().Column() _
                                .Text("Price") _
                                .DataIndex("Price") _
                                .Renderer(RendererFormat.UsMoney),
                            Html.X().Column() _
                                .Text("Change") _
                                .DataIndex("Change"),
                            Html.X().Column() _
                                .Text("PctChange") _
                                .DataIndex("PctChange"),
                            Html.X().DateColumn() _
                                .Text("Last Updated") _
                                .DataIndex("LastChange") _
                                .Format("yyyy-MM-dd")
                            ).View(Html.X().GridView().ID("indexGridView").DirectEvents(Sub(ls)
                                                                                            ls.RowDblClick.Url = Url.Action("EditDetail", New With {.id = 2, .containerId = "detailWindow"})
    
    End Sub
                ).Listeners(Sub(ls) ls.RowContextMenu.Handler = "e.stopEvent();#{GirdContextMenu}.param1 = record.data.ID; #{GirdContextMenu}.showAt(e.getXY()); return false;")))
    
    
    @Html.X().Window().ID("detailWindow").Modal(True).Hidden(True).AlwaysOnTop(True)

    Shared/_CompanyDetail.vbhtml
    @ModelType ExtNETExamples.ExtNETExamples.CompanyModel
    @Using (Html.BeginForm())
        @Html.AntiForgeryToken()
        @<div Class="modal-dialog">
            <div Class="modal-content">
                <div Class="modal-header">
                    <Button type="button" Class="close" data-dismiss="modal" aria-hidden="true" >&times;</Button>
                    <h4 Class="modal-title" id="myModal-label">Modal title</h4>
                </div>
                <div Class="modal-body">
    
                    <div Class="form-horizontal">
                        <h4> CompanyModel</h4>
                        <hr />
                        @Html.ValidationSummary(True, "", New With {.class = "text-danger"})
                        @Html.HiddenFor(Function(model) model.ID)
    
    
    
                        <div Class="form-group">
                                @Html.X().FormPanelFor(Model)
                        </div>
                    </div>
    
                </div>
                <div Class="modal-footer">
                    <Button type="button" Class="btn btn-default" data-dismiss="modal" onclick="$('#myModal2').hide();">Close</Button>
                    <Button type="button" Class="btn btn-primary">Save</Button>
                </div>
            </div>
        </div>      
    End Using


    You should see the problem when you run this code, that partial view return is being render in completely weird manner, html is getting render outside window which is strange, and form panel in window.

    Our requirement is that, we want to render partial view the way we are doing right now, but now we have purchased the ext.net, we want to simply use these controls on our partial views and render it simply.

    Since this is an example for your team, but in my actual problem we are trying to render Ext.NET GridPanel on _CompanyDetail and that too with Editable plugin. And we need to submit the data using model so editable grid should save it. So lets try to solve the first problem, and then we will move to the second one.


    Thanks,
    Puneet
  10. #20
    Hey Team,

    Gentle reminder! we are waiting for positive response.

    Thanks.
Page 2 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. Replies: 3
    Last Post: May 25, 2016, 4:22 PM
  2. [CLOSED] Error in Namespace when PartialViewResult render.
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Sep 28, 2012, 2:10 PM
  3. Replies: 1
    Last Post: Aug 10, 2012, 1:09 PM
  4. [CLOSED] Open a modal popup from a modal popup
    By Aparna_B in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 24, 2012, 8:58 AM
  5. [CLOSED] PartialViewResult Controls in MVC 2
    By tiramisu in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Apr 26, 2010, 9:05 AM

Tags for this Thread

Posting Permissions