asp.net-mvc-2

When I submit the partial view by either keeping the textbox filled/empty, in both cases full view is loading. How can I call Ajax to post it?

微笑、不失礼 提交于 2019-12-13 04:16:44
问题 I have Area in MVC3 as mentioned below. Model public class AdminModule { [Display(Name = "MyName")] [Required(ErrorMessage = "MyName is missing")] public String MyName { get; set; } } I have Partial View with following code. @model _1.Areas.Admin.Models.AdminModule @using (Ajax.BeginForm(new AjaxOptions { UpdateTargetId = "myForm" })) { @Html.LabelFor(i => i.MyName) @Html.TextBoxFor(i => i.MyName) @Html.ValidationMessageFor(i => i.MyName) <p id="getDateTimeString"> </p> <input type="submit"

forms authentication persistent across multiple servers

一世执手 提交于 2019-12-13 04:09:46
问题 I have an MVC 2.0 application that requires a persistent login(if chosen) using forms authentication which is load balanced between two servers. my webconfig(on both servers) looks like so: <authentication mode="Forms"> <forms name="MA_AuthCookie" loginUrl="~/Account/LogOn" timeout="86400" protection="All" path="/" slidingExpiration="false"/> </authentication> <machineKey validationKey="************

JQGrid Master Detail select/ MultiSelect on details grid not working

99封情书 提交于 2019-12-13 04:08:41
问题 I am trying Master Detail scenario in ASP.NET MVC 3 (default view engine) . I was able to go through the following code at http://www.trirand.com/blog/jqgrid/jqgrid.html and get master detail working. The problem is that when I select any row in details the first row seems to get selected / unselected clicking on link to find selected id's return ,null,null,null,null,nul Have anyone of you experienced the same. if you can point me to working ASP.NET MVC example with JQGrid Master Details , it

Model binding for a ViewModel containing multiple objects

北慕城南 提交于 2019-12-13 03:49:10
问题 I have a strongly typed view of type ProductListingViewModel which in turn contains a ProductViewModel. (both custom view models). I have some form elements on my page and these are created like so: <%: Html.DropDownListFor(m => m.ProductViewModel.CategoryId, Model.Categories)%> which generates the HTML: <select name="ProductViewModel.CategoryId" id="CategoryId"> With the default model binding I expected that when I post to my controller action which accepts a parameter of type

Get binary from uploaded file (image) in ASP.NET MVC

吃可爱长大的小学妹 提交于 2019-12-13 03:46:25
问题 I'm using the following code: <form action="" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file" /> <input type="submit" /> </form> And... [HttpPost] public ActionResult Index(HttpPostedFileBase file) { if (file.ContentLength > 0) { var fileName = Path.GetFileName(file.FileName); var path = Path.Combine(Server.MapPath("~/App_Data/uploads"), fileName); file.SaveAs(path); } return RedirectToAction("Index"); } Instead of

Best practices and tools for improving web server's performance in asp.net mvc?

烈酒焚心 提交于 2019-12-13 03:08:27
问题 Before the question here is what we tried to test the performance website. We simulated 80 users simultaneously on the website using JMeter. So, I am working on database issues and other problem. But one of the problems was the web server performance was not good and it was maxing out. So , I am in the process of improving the web server's performance and have downloaded Redgate Performance profiler and also dottrace. I was going to get into using these but I before that I thought of asking

Cascading dropdownlist with mvc and jQuery not working

﹥>﹥吖頭↗ 提交于 2019-12-13 02:56:31
问题 I am trying to use a solution for a cascading dropdownlist (the selection in one dropdownlist determines the options in the second one) found here: http://www.pieterg.com/post/2010/04/12/Cascading-DropDownList-with-ASPNET-MVC-and-JQuery.aspx <script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script> <script src="../../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { //Hook onto the MakeID list's

How to get the selected value from dropdownlist in Controller (MVC 2)

狂风中的少年 提交于 2019-12-13 02:49:48
问题 I am struggling to get the selected value from the hard-coded dropdownlist in mvc , below is the code: View: <tr><td>No of Helmets</td><td><div class="editor-field"> <%: Html.DropDownList("helmets", (SelectList)ViewData["size"], "--select--")%> </div></td></tr> <tr><td>No of Garages</td><td><div class="editor-field"> <%: Html.DropDownList("garages", (SelectList)ViewData["garages"], "--select--")%> Controller: // dropdown for helmets [HttpPost] public ActionResult Create(Event trackday,

HtmlHelper using ViewContext.Writer not rendering correctly

梦想的初衷 提交于 2019-12-13 02:47:43
问题 I am building a simple CMS with asp.net MVC and I have almost all the parts working. I have one minor issue which I can't work out how to solve. I have a Html helper method that renders the content of area. This method however uses the Response.Write to write its content rather than returning a string. The reason for this is that I'm performing a partial request and hence do not have a string to return. My template body looks like this: <body> <h1>Default Template</h1> <% Html.ContentArea(

Can't use relative paths with areas in ASP.NET MVC 2

微笑、不失礼 提交于 2019-12-13 02:38:35
问题 In my application I have an area call Mobile. In this area I have a folder call Assets where we place all our css, javascript and images. Accessing the views works just fine. http://localhost/webapp/mobile/stuff The problem is when I access my css, javascript and images. I cannot do something like this in my view. <img src="Assets/css/styles.css" /> The reason is because the real url is: http://localhost/webapp/areas/mobile/assets/css/styles.css Is there a way to map http://localhost/webapp