.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

Need an MVC Guru !!! Best Practice to have multiple Strongly Type Models ...inside a single View ??

Posted By:      Posted Date: October 26, 2010    Points: 0   Category :ASP.Net

So far I've seen demos of MVC that have simple pages, one for login, one for register, one for listing a table ...

In order to understand better the transition for WebForms developers into MVC patterns, I would like to understand how can I put together multiple CONTROLS (like the one provided by the default MVC project that VS2010 creates for us ...and make it work.

OK so as an example, imagine we want to change the LogonUserControl.ascx to allow us to login (so to show UserName and Password textboxes and Logon button) from the Home Page.

1) We update the Control as follow:

2) We update the HomeController.cs file to handle the Logon Button Post event as follow:


We needed to move some code from AccountController to HomeController in order to get the control to work under the Index view. So ...with little luck it seems to work !!!

Now the problem happens when you navigate to the Register view, considering that now we are not any longer on the HomeController "domain" but we are under AccountController.

Register page shows perfectly and

View Complete Post

More Related Resource Links

Using Multiple Childview inside View

I want to create a view which will include 2 sections. In first section user selects values from dropdown and then click Search button, And want to display results in same View.Second section should comes after click event.  How should i implement this in MVC. Am filling dropdown using Viewdata so clicking on search button invoke action in controller. public actionresult search(){} /// in this action am loading all dropdowns with Viewdatapublic actionresult Searchresults( formcollection  post){  //search logicreturn view('search');}   problem am facing is when second action executes dropdowns starts looking for viewdata which is no more there. Can somebody help me

how to display multiple calendar list data in single calendar view

Hi, Normally, we can used to extend the ListViewWebPart's ViewType property to display a particular calendar list items in Calendar View in our custom webpart. Is it any way to display multiple calendar list data in a single calendar view ?? or please provide some pointers related to this issue. Any help is much appreciated.    

MVVM - Multiple ViewModels of same type --> Singel instance of view


I have a ViewModel that contains a property WorkSpaces:

public ObservableCollection<ServiceViewModel> WorkSpaces{get; set;}

The WorkSpaces I bind to a ContentControl that contains as ItemTemplate a DataTemplate which contains a TabControl

<ContentControl Content="{

Multiple Content Types in a single list - how to edit fields outside a content type

I have a single list and created two content types on the list in order to reduce the amount of visible fields a user sees when entering a form.  Once the form is filled out by one group with the limited data, an alert is sent to another team that adds to the list item using the larger set of fields defined by the second content type.  Unfortunately it seems that the edit burron remembers ihe initial content type that the entry was created with.  Is there another url to access the edit button for the same entry using the alternate content typr?

Strongly Typed HtmlHelpers and View Models



I am not sure why this happens, but when I have an Html.TextBoxFor(model => model.SomeObject.SomeProperty), when I post, the property of that object is always null.

When I look at the markup generated, I see <input type="text" name="SomeObject_SomeProperty" id="SomeObject.SomeProperty" value = "" />

If I change the helper to Html.TextBoxFor(model => model.SomeObject.SomeProperty, new {id = "SomeProperty"}) the controller is then able to pick the value up. Why is this happening? I feel as though I shouldn't have to be specifiying the id for the textbox as it works when fine when not using child objects on a view model, IE <%: HtmlTextBoxFor(model => model.SomeProperty) %>.

two models inside one view



I my strogly typed view, I am returning single blog post. it is working perfectly.

problem is here;

also i need to return the comments which have been made on the post in the same view. but the model of the comments is different. What should I do ?

I ca return them by hardcoding on the view with foreach loop but it is not so useful for mvc and I am thinking there should be some easy way for this. thanks !

UnTyped DataSets and Strongly Type DataSets

We all are use datasets as a means of carrier of data from one layer to another. Most of the time we are using weakly typed datasets. In this article I will explain the differences between weakly typed datasets and strongly type datasets

Gmail style multiple Sign-in type combo...is it possible in asp.net?


I am developing a multi-company application and want my users to give the functionality like the following to switch companies.


Is this possible? then how?

Please help


merging multiple tables in a single dataset to single table


 i have a stored procedure which returns three tables to a dataset ..... now i need to merge all three tables to a single table from d same dataset 

like dataset1 has table1 table2 and table3 .... i want all the three tabels to be merged into dataset1 itself .... instead of three diffrent tables so that i can show all three table data in a single datagrid  as a compact data and combination of 3 tables from d single dataset.....

can some1 help me please.....

Usability in Practice: Getting Inside Your Users' Heads


This article explores techniques developers can use to gather information about and incorporate their users' mental models in their software designs.

Ambrose Little, Dr. Charles B. Kreitzberg

MSDN Magazine October 2009

Inside Microsoft patterns & practices: Building WPF and Silverlight Applications with a Single Code


This article discusses the Project Linker tool and other techniques to create applications that target both WPF and Silverlight from a single code base.

Erwin van der Valk

MSDN Magazine August 2009

Toolbox: Easy File Backup, Exploring Files And Folders Inside Visual Studio, Multiple Monitor Softwa


If the responsibility for creating, managing, and executing routine backups is yours, these tools will make it easier. Also see how you can browse folders and files from inside Visual Studio.

Scott Mitchell

MSDN Magazine May 2009

how to set multiple button in single image


Hi friends,

I need to make multiple button in a single image in asp.net.

and need coding also for vb.net.

thanx in advance

single form multiple buttons in MVC


In a single page  has two buttons , ddown and tempname.

I wrote two actionresult separetly each one for ddown and tempname.

I need one is post and another one is get method. so i gave like

1. Get Method


        [AcceptParameter(Name = "button", Value = "tempname")]
        public ActionResult ddown_tempname(string statusName, NewsLetterAdminViewModel viewModel)

return View();



2.Post Method


        [AcceptParameter(Name = "button", Value = "ddown")]
        public ActionResult ddown(string statusName, string button, NewsLetterAdminViewModel viewModel, FormCollection collection)

return View();



if i call the post method its worked well. but if i call the get method, the code does not execute. the brea

using single function to open multiple colorbox


Hi I have li like this

<li class="game">
                                    <div class="game-thumb">
                                        <a href="include/games/words.swf" class="gamelink">
                                            <img src="include/games/words.jpg" /></a></div>
                                    <div class="thumb-desc">
                                <li class="game">
                                    <div class="game-thumb">
                                        <a href="include/games/cat.swf" class="game2">
                                            <img src="include/games/dots.jpg" /></a></div>
                                    <div class="thumb-desc">
                                        Trap the CAT</div>
                                <li class="game">
                                    <div class="game-thumb">
                                        <a href="include/games/gravitymaster.swf" class=&qu

How to store and retrieve multiple values in a single session variable .


I want to store employee name,designation and department in session variable and
retrieve in another page how to do this.

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