asp.net-mvc-2

ASP.NET MVC2 displaying 2 lists of data in a strongly typed view

六眼飞鱼酱① 提交于 2020-01-17 01:42:07
问题 I am having difficulties displaying a list of data that incoporates two database objects. My view is strongy typed to a view model that includes a list of customers and a list of customer sites (each stored in their own table). Im currently using two for each statments to render both lists, but really i need one list that contains both objects, in a nutshell its a list of customer sites that also contains customer names from the customer table. This is my viewmodel namespace CustomerDatabase

Advanced ASP.NET MVC routing scenario

邮差的信 提交于 2020-01-16 08:35:23
问题 I have an ASP.NET MVC app with the following deployment requirements: The URL structure must be something like: http://server/app/[enterprise]/[communinty]/{controller}/{action}/... What I think I want to be able to do is intercept the URL before the MVC route handler gets its hands on it, remove the [enterprise]/[community] parts, and then allow MVC to continue processing as if the original URL had not contained those two segments. Here's why: The application exposes multiple portals to

Changes Cascading down to children in a Tree structure ASP.NET MVC 3

跟風遠走 提交于 2020-01-16 07:56:25
问题 This is for an ASP.NET MVC 3 application and deals with updating children nodes in a tree structure. The user is allowed to make changes to any part of a node in the tree. Once the user has made a change, (i.e. to a Status field) that change will have to be cascaded down to all the children. The issue is there are an arbitrary amount of children and their children have an arbitrary number on children and so on. How would I go about doing this? Thanks anyone who can help! EDIT I would like for

Multiple selection of ListBox is not working in asp.net mvc4

独自空忆成欢 提交于 2020-01-15 19:11:14
问题 I have bound listbox data from entity framework. I have selected multiple values in that listbox. But, the values are not fired. The count of the property is 0 only. I am using the code below: public class Sample1 { [Key] public int SampleId{ get; set; } public string SampleDesc{ get; set; } } public class ExpModel { public List<Sample1> Sample{ get; set; } } public ActionResult Index() { ViewData["SampleList"] = new List<Sample1>(entity.samp); return View(); } @Html.ListBoxFor(model => model

Refreshing a dropdownlist after elements have been reset

放肆的年华 提交于 2020-01-15 11:42:46
问题 i have an asp.net mvc 2 application, and have some jquery that defines behaviour of two dropdownlists. When one changes, the other is populated with filtered data. After much furor, i have the jquery working, confirmed by firebug debugging, but my dropdownlist is not refreshing. This is the jquery <script type="text/javascript"> $(function () { $('#cid').change(function () { var coid = $(this).val(); $.post("/TimeTracking/FilterFieldOffices", { companyId: coid }, function (data) { $("#foid")

Refreshing a dropdownlist after elements have been reset

谁都会走 提交于 2020-01-15 11:42:43
问题 i have an asp.net mvc 2 application, and have some jquery that defines behaviour of two dropdownlists. When one changes, the other is populated with filtered data. After much furor, i have the jquery working, confirmed by firebug debugging, but my dropdownlist is not refreshing. This is the jquery <script type="text/javascript"> $(function () { $('#cid').change(function () { var coid = $(this).val(); $.post("/TimeTracking/FilterFieldOffices", { companyId: coid }, function (data) { $("#foid")

Handle HTTP-Headers and status codes in controller

醉酒当歌 提交于 2020-01-15 11:37:08
问题 Im currently polling data with from an Database with an regular interval. For the backend I'm using C# and MVC2 as framework. As I'm fetching data with an interval of 10 seconds now I would like to in the backend in my controller implement some kind of conditional that will parse the http header and not fetch the data again if it has not been modified since last fetch. I'm not really sure how I would go about with this. Anyone have any good suggestions?! Regards 回答1: Why mess around with http

Handle HTTP-Headers and status codes in controller

好久不见. 提交于 2020-01-15 11:37:06
问题 Im currently polling data with from an Database with an regular interval. For the backend I'm using C# and MVC2 as framework. As I'm fetching data with an interval of 10 seconds now I would like to in the backend in my controller implement some kind of conditional that will parse the http header and not fetch the data again if it has not been modified since last fetch. I'm not really sure how I would go about with this. Anyone have any good suggestions?! Regards 回答1: Why mess around with http

Handle HTTP-Headers and status codes in controller

橙三吉。 提交于 2020-01-15 11:36:13
问题 Im currently polling data with from an Database with an regular interval. For the backend I'm using C# and MVC2 as framework. As I'm fetching data with an interval of 10 seconds now I would like to in the backend in my controller implement some kind of conditional that will parse the http header and not fetch the data again if it has not been modified since last fetch. I'm not really sure how I would go about with this. Anyone have any good suggestions?! Regards 回答1: Why mess around with http

ASP.NET MVC2 - specific fields in form pass via a specific object?

非 Y 不嫁゛ 提交于 2020-01-15 09:42:21
问题 In database I have Contacts table: ContactID (int) FirstName (varchar) LastName (varchar) ... XmlFields (xml) // This field is xml type To create a new contact, I created two classes - one for regular fields and other to display fields from XmlFields field. In Controller, I have following: public ActionResult Create(Contact contact, FormCollection collection) ... Regular field I catch with contact object and those that need to be stored as xml in XmlFields I try to catch with collection