.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

New ways of doing old things in MVC

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

This is my first forray into ASP.NET MVC, having been doing WebForms for nearly 6 years now. I've read through various tutorials and guides on getting started with MVC, but I've a few questions about how you're meant to do things:

UserControls for entities

In an application I wrote a few years ago (using WebForms) there were many entities that had an associated postal address (which existed as an instance of an Address class), so I created a UserControl that contained fields for working with addresses. During the page lifecycle I would pass the business object's .Address property to the UserControl for display and for population upon a successful and valid postback.

How would I do something like this in MVC? My current project has a similar situation where common sets of fields are repeated throughout the application and all 'map' to the same class.

Modifying the page/view on 'postback'

Say I'm working on a data-entry form for an online B2B ordering system, where the user manually enters order items into a series of textboxes arranged in a table. The system can only provide so-many textboxes at a time (usually 5 or 10). If the user ran out of textboxes they would click an "Add more rows" button that performed a postback that was caught by that button's server-side .Click

View Complete Post

More Related Resource Links

Six easy ways to customize your site using Web Parts in SharePoint

Becoming familiar with Web Part customization techniques gives you a range of page-customization choices. For example, you can customize your site's home page so that it displays the specific information that your team needs. You can rearrange the list items on the home page, add lists, and even change the images on the home page. As you become more familiar with Web Part Page customization techniques, you can build interactive Web Part Pages that makes the data in lists more dynamic and useful, and you can add new Web Parts that provide access to external data and Web services.

SharePoint 2007 Workflows - Things to Consider Before You Start

SharePoint 2007 (MOSS) utilizes the Workflow Foundation (WF) to enable workflows on lists and content types. But before you start doing cartwheels there are few things you should know before you get started. The experiences I'll be discussing are not from book smarts but from building real MOSS solutions that are in production today.

Concurrent Affairs: Four Ways to Use the Concurrency Runtime in Your C++ Projects


This article describes how to integrate the new parallel computing libraries in the Visual Studio 2010 Beta into existing C++ projects. Based on four common scenarios, the column explains a few of the ways developers can use the APIs and classes that are part of the Parallel Pattern Library (PPL), Asynchronous Agents Library, and Concurrency Runtime.

Rick Molloy

MSDN Magazine October 2009

Usability in Practice: When Things Go Wrong


This month our usability experts explain what it takes to create informative, useful error messages.

Dr. Charles Kreitzberg and Ambrose Little

MSDN Magazine January 2009

Editor's Note: Some Things Are Easier Said Than Done


Executive Editor Josh Trupin gets himself in trouble with live electrical current and a penchant for twiddling.

Joshua Trupin

MSDN Magazine October 2006

Test Run: Five Ways to Emit Test Results as XML


The use of XML files in software testing has steadily increased over the past few years. Test case data, test harness configuration information, and test result data are now stored as XML. Recently I was writing some .

Dr. James McCaffrey

MSDN Magazine June 2006

Got Directory Services?: New Ways to Manage Active Directory using the .NET Framework 2.0


System.DirectoryServices is a managed code layer on top of Active Directory Service Interfaces, and you can employ it to better manage Active Directory from your code. Here Ethan Wilansky helps you get started.

Ethan Wilansky

MSDN Magazine December 2005

What is the best way to add an extra row to the bottom of a listivew for such things as totals, etc.

 I can add a row to the bottom of a listivew by inserting a table after the layouttemplate in a listview.  It works fine for me to call the added controls from code-behind and chane the control values. Since my listview changes width dynamically depending on the contents of the data, my added table columns don't match up.  I have tried to access the width property of the table and then match the new ones with codebhind, but it doesn't seem to work. I am simply trying to add a row to the bottom of the listview to provide for totals of the columnts.  What is the best way to to that?   Thanks

Problems with Farm Account magically losing permissions to certain things

I don't know what's going on, but this has now happened two times in a row during my rebuild from TP to Beta (completely new build from the OS up).  I'm using the same service account (domain account) as my setup and farm account.  While logged in with my farm account, I install the SP2010 pre-reqs, then the bits, then give it dbcreator and securityadmin roles in SQL, then run the SPT wizard.  Within the wizard, I specify the same account as my farm account, and all works fine and dandy.  After it's done, I'm able to get into Central Admin with this same account and see/do everything.After working with things a while and following the MS instructions for getting the User Profile SA working, if I reboot or logout/login, then I suddenly don't have access to some very important things, such as:- System Settings > Manage Services on Server.  It just disappears completely- Security > Configure Service Accounts.  This does not disappear, but clicking on it causes a prompt saying "Error:Access Denied."  Previously, I was able to go in here and set my service accounts for things like search, user code service, etc (I set them to the proper service accounts)- Configuration Wizards > Launch Configuration Wizard.  I used this multiple times when getting my farm setup, but now it's gone.I've gone so far as to make my farm account all of these things:- Member of B

What all things one need to keep in mind while converting Asp.net 3.5 project tot Asp.net 4.0 ?

Hi,What all things one need to keep in mind while converting Asp.net 3.5 project tot Asp.net 4.0 ?Are there any issues regarding use of third party controls like Telerik ?Kindly guide... Thanks in advance.

Things I like about Scala

I'm excited about Scala (see Scaling the Cliffs to Scala ), one of the new Object-Fuctional languages that have emerged recently.  So, what excites me?  Let's list a few cool features. Everything is an object. Scala functions are really and truly first-class objects. Let's not forget that Scala gives us Closures! Mixins really rock!  They bridge the gap between multiply inheriting from interfaces and multiply inheriting from classes. Traits are like Java interfaces, but with implementations (behavior).  They provide a mixin composition mechanism I haven't had in other languages. Scala pays lots of attention to properly using mutability and immutability.  From having declarations of val vs. var to Value Objects and "side-effect free" functions, Scala provides the underlying support necessary to help us with multi-threading, multicore processing, and multi-processing.  Scala's implementation of concurrency and its Actor Framework make it one of the most interesting new languages around. I would recommend a study of Scala just for these benefits alone.  They're largely why I decided to use Scala for development of Chronoscope, the product on which I'm working at the moment.  

Ways to exctract data besed on current day

Dear all, I have a table which have fields like FirstNAme, LastName, StratOn, EndOn StartOn and EndOn are datatime fields This table is a kind of registration table and I would like to exctract from this table all records where the EndOn fields is corresponding to current day. I do not know in fact the correct way to compare the EndOn field in order that it correspond to the current day in term of year, month and day thnaks for help regards serge  Your knowledge is enhanced by that of others.

How do you write a program that can search for things on Google?

I just finished a web scraper so I am not brand new to this but I don't know whow to have my program fill in the fields for a web form. Basically, there is a web application we use at work which I want to integrate with. The first thing you have to do is tell the web app that you are searching by city (via drop down list). The page refreshes. Then you type the name of the city into a text box and hit submit to get your results. I think it might be done in ASP.NET I can't rememebr off the top of my head.   But just for a Hello World kind of app can someone tell me how to write a program that can do a search on Google? Like what does the request look like?

SSIS: How to set the values of the variables, other ways of setting the values of the variables?

Hi Gurus, Is this the only way in setting the values of the variables. Please see steps below: 1. Build the SSIS Project. From the package's property pages, Deployment Utility, set the CreateDeploymentUtility to TRUE (It will create a Deployment Folder and inside the folder 3 files will be created a) SSISDeploymentManifest b) dtsConfig c)dtsx ) 2. Double click the SSISDeploymentManisfest file. A Package installation will be set up. 3. Follow the steps until you reach the Configuration Packages: Edit package configurations window. 4. From the Configuration part, set the values from the Values(column). 5. To Finish. Is this the only way of setting the values of the variable?

How to display TreeViewItems different ways based on the item type under a single node?

Hi, I am having trouble trying to display hiearchical data under each node in two different ways depending on the data.  I hope someone will be able to provide me some help on this since I am rather new to WPF development. Maybe I am going about this all wrong but for now, I am trying to create a customized TreeView to represent data similar to the xml I provided in the code below.  The <ItemsPresenter/> instances listed in the code are not exactly doing what I need.  I will probably need to filter the content that I list with each of the two <ItemsPresenter/> tags based on the type of each item although I have no idea if this is possible.   <Window x:Class="Wpf_treeview_testing.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <!-- * The "xmlData" describe roughly the type of data that I require visual representaion of. * Since I could not find a WPF Control that will present a Hierachical Data Template close to what we need, I am trying to setup a TreeView to represent this information by using a ControlTemplate for TreeViewItem. * The preferred result is to present different items types in

what are the best ways to create left hand navigation?



what are the best ways to create left hand navigation?

So that administrator of the site will be able to add or remove the nodes of left hand navigation on fly?


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