.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Load View and Partial View (Master/Detail) with default parameter(s) ?

Posted By:      Posted Date: September 08, 2010    Points: 0   Category :ASP.Net
MVC newb.  Members view (index) that lists members that users can select to show a partial view in the same view with details for the selected member Uses jquery (Ajax.ActionLink) to call a partial view method in the members controller to then load the members detail section Works fine up to here....but I'd like to load the partial view with "member" details for a default or random member on initial load -- ie not through the Actionlink selection How do I invoke the partial view method on the initial load?  I'm sure this is basic stuff but still still getting my head around the mvc "way" Can someone point me to an example or explanation somewhere?  (not turning anything up on my searches thus far)   thanks in advance!!

View Complete Post

More Related Resource Links

partial view, 2 controllers



This is my first visit to the forums, I hope someone here can help me


I'm writing a small webapplication for creating repair tickets and adding comments, really basic

now I'm writing this in MVC2

So I have 2 controllers, 1 HomeController that does everything related to the tickets (listing tickets, creating new ones, editing) and 1 controller for the comments

the edit view for the homecontroller contains a partial view for /comment/create

so /home/edit/ticketnumber can edit the title and status of the ticket on the left side of the screen, the right side of the screen contains the partial view for adding comments

this is done like this:

Html.Renderaction("Create", "Comment");

but if I look at the generated html code when running the app, both save buttons go to /home/edit/ticketnumber

so the comment is never saved.


I hope this makes sense and that someone can help me solve this

Personal view reverts back to default after updating properties of item


I am working with a company that has 1 site collection with several sub sites.  I have built 3 document libraries with workflow in 3 different sub sites and all behave as expected.  I have one site where ALL libraries do something perplexing;

If you are in a custom personal view and you go into the properties of a document and then exit (update or not, does not matter) it reverts back to the default view of that library. 

Has anyone seen this?  is there an option when creating an album that could cause this?

thanks in advance for any input on this odd issue.

Disappearing partial view


I have a view that uses a partital view.  The partial view is invisible when the page loads.  The user then clicks a button and I use Html.RenderPartial to make the view appear.

There is a button in the partial view in which the use will click which should make the partial view disappear.  How do I make the partial view disappear?

Thanks for the help!

When i click on any other folder in the document library that will navigate to default view of DL?



I have document library with having some folder in the same ,i have displayed my library in the page as Treeview, so when i click on any of the folder in the library i need to navigate allitems.aspx page i.e default view page of the document library ,the document library having views.Suppose when i am in other view i have selected folder from library treeview folder is changing but view not navigate to default view.

pls help 


When the user want click on document library that should be navigate default view



I have document library which is having folders,the document library i have displayed as tree view in the left side of the page.

Here Document library having views,suppose i have selected one view on the document library it is navigating the particular view that is good but when i am trying to click document library folder still the page in same view do not navigate the default view .

I need when ever i click on any of the folder in document library that should navigate defualt view ,could you please help me on this.

Really its need urgent...


VS 2010 XAML Design View Load always fail with a Type Load Exception

Create a new WPF project in VS and change nothing. The Design View will fail to load with the error below. Error    1    Could not load type 'Microsoft.Expression.DesignModel.Core.ISharedInstanceBuilder' from assembly 'Microsoft.Expression.DesignModel, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Microsoft.Expression.DesignModel is an assembly from Expression Blend. I ever installed Blend 4 RC and uninstall and install Blend 4. I Reflector the assembly I have under Blend 4 bin folder. And cannot find a interface named ISharedInstanceBuilder. But the WPF project is a Template project without any changes. How it get related with Blend 4? And how to fix it? Thanks.  

Rendering Partial view postback with data posted back and entire view context

This is the base Index.aspx view:<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> <%@ Import Namespace="LMWebUI.Components" %> <%@ Import Namespace="LMWebUI.Models" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <% Session["HasScripts"] = "false"; %> <% if (Utility.FixNull(Session["LoggedIn"],"false") == "false" ) {%> <% ViewData["Login"] = new PartialRequest ( new { controller = "Account", action = "LogIn" } ); ((PartialRequest)ViewData["Login"]).Invoke(ViewContext); %> <%} else {%> <div>Logged In Content here</div> <%}%> <script type="text/javascript"> LMx.init(); </script> </asp:Content> This is a helper class> that I found elsewhere, doesn't solve the problem, but still works to display the viewpublic class PartialRequest { public RouteValueDictionary RouteValues { get; private set; } public PartialRequest(object routeValues

group member detail view

hi, i have add member group to my detail view. but it does not show the member group correclty. it shows a lot duplicated members. and members that are not in a group it shows that they are in the group. i know you can not modify the wss_conten database. how can i still use group member in dataview?

RenderAction failing in site.master, but works in a view

Hi, I have a master page into which I'm inserting a 'Search' partial view, which I've called 'pSearch.ascx'. I need to pass in a model to make some data available to pSearch, so I am using RenderAction from the site.master page, which then should call a [ClientActionOnly] Action on the 'Home' controller, called SearchPartial(), which in turn returns the pSearch view.Code from site.master:    <% Html.RenderAction("SearchPartial", "Home"); %>Code from HomeController.cs: (the method is virtual because I'm using T4MVC in the project)        [ChildActionOnly]        public virtual ActionResult SearchPartial()        {            return View(MVC.Curious.Views.pSearch);        }This is the error: "No route in the route table matches the supplied values."However, when I remove this line from site.master & insert the IDENTICAL RenderAction() call into one of my view pages, it works fine.I've been pulling my hair out, trying permutations of how it's called and different approaches, but can't work this one out, particularly because it works in a view page based on site.master, but not in site.master itself.Can anyone suggest why it wouldn't

Dynamic Javascript in Ajax Partial View

I have a partial view which uses Ajax.ActionLink to perform paging.  The AjaxOptions in the link identify the update target (a div on the main view) and some javascript to run OnSuccess (in the partial view).  The javascript must be in the partial view since there is some information in the partial view required to properly wire up the jQuery in the javascript.  This isn't working as expected.  The sample below is the minimum code to duplicate the behavior I am seeing: Controller: private static int count; // // GET: /Home/ public ActionResult Index() { ViewData["Test"] = count++; return View(); } [HttpPost] public ActionResult TestPartial() { ViewData["Test"] = count++; return PartialView(); } View:  <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Index</title> <script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script> <script

Partial view and postbacks - undesired results

Sorry for the long post,I'm having problems after the postback. Each time I post back the changes made on the ui - I see the changes in the RateViewModel passed back, but the code populates each control in the table with these values - instead of the values from the ViewModel. What am I doing wrong?Object.public class CurrentAndFutureRate{        public int ParentID { get; set; }        public int ParentTypeID { get; set; }        public string ParentTypeDescription { get; set; }        public decimal CurrentRateValue { get; set; }        public DateTime CurrentStartDate { get; set; }        public DateTime? CurrentEndDate { get; set; }}View Modelspublic class CurrentAndFutureRateViewModel { public List<CurrentAndFutureRate> CurrentAndFutureRates { get; set; } } public class RateViewModel { public int ParentID { get; set; } public int ParentTypeID { get; set; } public int? RateID { get; set; } public decimal RateValue { get; set; } public DateTime StartDate { get; set; } public DateTime? EndDate { get; set; } } Master page renders a partial view(1) and the partial view displays a table

Ajax.BeginForm does not update/show the result in partial view


I have a view.On which i have two partial viewMy m ain is like this ->.(Note i am using Ajax.BeginForm here.)

<body >
<% using (Ajax.BeginForm("SearchRequests", new AjaxOptions { UpdateTargetId = "SearchRequestDIV" }))
   { %>
 <%-- <%using  (Html.BeginForm("SearchRequests", "PlanRequest", FormMethod.Post, new { enctype = "multipart/form-data" })){ %>--%>
    <div >
       <table class="tableborder" border="0" cellpadding="0" cellspacing="0">
            <%if (Model.MessageText !="" && Model.MessageText !="undefined") { %>
                <td >
                    <font color="red"><%=Html.Encode(Model.MessageText)%></font>
                   <% Html.RenderPartial("SearchRequestCriteria", Model); %>         
            <% if (Model.SearchResults.Count > 0)
               { %>
                 <div id="SearchRequestDIV">

how to restore view style to default... urgent


dear friends,

I have changed default font size of '.ts-syslabl' in view style of "Boxed" for a page. But it is reflecting in all view styles. May be i corrupted main css core file or vwstyles file with respect to that site collection. How to restore to default file with respect to css. Kindly help me out . It is urgent ...please.. It is the problem with only one site collection in which i tried.

I used Sharepoint designer 2010 .

pleasehelp me out

How to Disable Specific Column in Data Grid View and write something in Cell and load data in anothe


Hello All  ,

i have data grid view and i want to disable specific column from writing in it and in another column 

i want to write something like item code and load the item name automatically in the corresponding cell in the disabled column 

i hope that i write my problem correctly and you can understand what i want :)

thanks in advance ,

Kareem Naguib

Using a partial in a strongly typed view


I have an application that is going to allow a user to create records of type Customer and Seller that have one section in common, but other fields that are unique to their types.

Both of these types will have an address block for their create view.

If I have a strongly typed Customer or Seller view, how can I use the view partial (containing the address block) that I've created? I've tried creating a view model, but I don't know how to have the create page inherit the Customer model and the addressBlock partial inherit the addressBlockForm partial model...

Hopefully, this makes sense, and thank you for any help.

change "View Report" Submit button Caption in parameter area


Hi All.

Using SSRS 2008.

Can please suggest, Is there a way to change the caption of submit button that appears when we have report parameters. "View Report" to something else

Thanks for replies.



[Problem] MVC DropDownList Cascading Partial View


Hi, i'm trying to implement a cascading dropdownlist inside a partial view.

this is the code:

js function

function dropDownListCascade() {
    $('#idTipoAntecedente').change(function () {
        $.ajaxSetup({ cache: false });
        var selectedItem = $(this).val();
        if (selectedItem == "" || selectedItem == 0) {
            $("#idAntecedente").attr('disabled', 'enabled');
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend