Partial View - Page Reload

Threaded View

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

    Partial View - Page Reload

    I have implemented a combo live search box. when user selects a particular search result, search result info is passed back to my action, but once I am trying to reload the page after user selects it and display new information, the page doesnt reload and new info is not displayed

    Here is what I want to do:

    after user selects an option, send some information back to action(which I did) and reload the page displaying extra content to the side of the search box. Even if this needs to loose the search box selected item, i am fine with it.
    but page reload and some extra content have to be main req.

    Please let me know how to implement this. below is what I tried.

    //Combo live search code would be same as in Ext.net Example.
    //then I created a direct listener for the item user selects a particular item
    .DirectEvents(de =>
                            {
                                de.ItemClick.Url = Url.Action("Selected_pat");
                                de.ItemClick.EventMask.ShowMask = true;
                                de.ItemClick.ExtraParams.Add(new Parameter() { Name = "ICode", Value = "#{cbxLiveSearch}.getValue()", Mode = ParameterMode.Raw });                    
                            })
    this is passed to action in controller, which I followed with MVC declarations like below
     public ActionResult Selected_pat(int ICode)
            {
                Pat p = new Pat();
                p.i = 0;
               
               
                return PartialView("Selected_pat",p);
            }
    
    //Selected_pat is my view name and p is sent to model to access its information

    //Here is my view that I want to display the model information.
    
    @if (Model.i == 0) // i will set the i value in action, so that this wont be rendered first time
        {
    @Model.sLastName
    @Model.sFirstName
    }
    However I was able to get the information I passed to view via model, but for some reason due to scripts running background wouldnt allow the page to reload and eventually model parameters are not being set .



    Any help is very much appreciated.

    Thanks,
    Vakshu.


    Updated Code:

    View page : combo search
    // I have a update target id which I would like to update just like in MVC.
    .DirectEvents(de =>
                            {
                                de.ItemClick.Url = Url.Action("Selected_Pat");
                                de.ItemClick.EventMask.ShowMask = true;
                                de.ItemClick.ExtraParams.Add(new Parameter() { Name = "ICode", Value = "#{cbxLiveSearch}.getValue()", Mode = ParameterMode.Raw });
                                
                                de.ItemClick.ExtraParams.Add(new System.Web.Mvc.Ajax.AjaxOptions() { UpdateTargetId = "Selected_pat" });
    Controller action:
    Public ActionResult Selected_Pat(int ICode)
    {
    pat p = new pat();
    p.i= 0;
    return PartialView(Selected_Pat, p);
    }
    trying to access then the id with contained in view page again, which has to be from partial view page.

    @if(Model.i == 0)
    {
    @(Html.X().Container().StyleSpec("border:solid 1px black; height:150px; width:300px;")
    .ID("Selected_pat")
    
    .Loader(X.ComponentLoader()
                .Url("/Pat/Selected_Pat")
                
    ))
    } // I am not using this component. Instead I am using the div tag and renderpartial
    
    
    // tried this code for rendering partial view like in MVC. id is declared on the top and the render partial is shown
    below which will be enclosed with <div id = "Selected_pat"></div> tags
    
    @html.renderPartial("Selected_pat", Model)); --> it gives error:
    cannot be converted of type 'void' to 'object'.
    I am not merging mvc code with any code of Ext.net. It seems there is a problem just to use the MVC code alone along with Ext.net. Can I know the reason for this or am I declaring the wrong way ?

    Still I dint get it to be working..If anyone has worked on same situation please reply.
    Last edited by rvisha2; Oct 04, 2013 at 2:26 PM.

Similar Threads

  1. [CLOSED] Partial View
    By PriceRightHTML5team in forum 2.x Legacy Premium Help
    Replies: 9
    Last Post: Jul 16, 2013, 1:16 PM
  2. [CLOSED] Loading Partial View within a Portlet
    By PriceRightHTML5team in forum 2.x Legacy Premium Help
    Replies: 9
    Last Post: Jul 15, 2013, 5:14 AM
  3. [CLOSED] Partial View not Rendering
    By RCM in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 01, 2013, 3:10 AM
  4. [MVC] How to use a partial view in a window?
    By KBorkiewicz in forum 2.x Help
    Replies: 7
    Last Post: Nov 21, 2012, 11:11 PM
  5. [CLOSED] [2.1] MVC Partial View
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 23, 2012, 12:04 PM

Tags for this Thread

Posting Permissions