asp.net-mvc-2

An Ideal Folder Structure for .NET MVC [closed]

蓝咒 提交于 2019-12-02 15:31:47
When I started in .NET Webforms I didn't have much trouble finding a folder structure to follow since VS offered you application folders like "App_Code" and most app examples put "BLL", "DAL" inside there and so on. But now in MVC, every example I check uses different structure, like no standards this time and I haven't found a good solution on Google or SO. So, maybe we can share how we organize our MVC projects, may help others to make their own mind. Here is the structure for small to medium projects I use: App_Data Areas Admin Controllers Models Views MyAccount Controllers Models Views

How to enable up/down arrow keys in jqgrid inline edit

Deadly 提交于 2019-12-02 15:04:24
问题 How to implement excel like order detail edit grid. This grid should be like excel: preferably up/down arrow keys move to previous / next row and start cell editing All cells are always in edit mode or edit mode starts if up / down arrow key is pressed or cell receives focus in any other way. tab moves to next cell in row Submit button sends all rows to ASP .NET mvc controller in server Is it reasonable/how to implement this using jqGrid ? All jqGrid examples which I have found does not allow

MVC2 EditorTemplate for DropDownList

∥☆過路亽.° 提交于 2019-12-02 14:44:49
I've spent the majority of the past week knee deep in the new templating functionality baked into MVC2. I had a hard time trying to get a DropDownList template working. The biggest problem I've been working to solve is how to get the source data for the drop down list to the template. I saw a lot of examples where you can put the source data in the ViewData dictionary (ViewData["DropDownSourceValuesKey"]) then retrieve them in the template itself (var sourceValues = ViewData["DropDownSourceValuesKey"];) This works, but I did not like having a silly string as the lynch pin for making this work.

Putting icon instead of “ + ” or “ - ” in an accordian menu.js file

扶醉桌前 提交于 2019-12-02 13:18:29
I am making an accordian menu. I just found this link http://jsfiddle.net/zM5Vj/ , and it is almost similar to the accordian menu I have made. In the code, where there is if($(this).text() == "-") { $(this).text("+"); } else { $('#accordion .opener').text("+"); $(this).text("-"); } }); If insted of "+" and "-", i want to put icons "~/Image/iconplus.gif" and "~/Image/iconminus.gif". How do i do so? I have tried <img src="..."/> But still it is of no use. Please can anyone help? Thanks in advance. $(this).text() allows you to specify plain text content for an element. To attach an image, use $

Need to update the check box value to db table when i click the checkbox() without post back in MVC2

余生颓废 提交于 2019-12-02 12:03:56
<input type="checkbox" name="n" value=1 /> <input type="checkbox" name="n" value=2 /> <input type="checkbox" name="n" value=3 /> I have above checkbox when i select the this i need to update the DB table without post back. Please explain.. If possible you can say jquery or ajax method to solve my problem You have to do some sort of request back to the server, whether it's a POST from a form button or an Ajax POST or GET request. Form button: <form action="/MyApp/HandleClick/" method="post"> <input type="checkbox" name="SelectedObject" value="cbValue"/> <button type="submit">Submit</button> <

ASP.NET MVC 2 Reload pages without refresh and keep URL changing

故事扮演 提交于 2019-12-02 11:36:55
I am creating a project using ASP.NET MVC. I want to show content of pages in the placeholder without refreshing the page, something like ajax but WITH the URL changing, How can I accomplish this ? Thank you for your responses I've used the jQuery BBQ plugin (http://benalman.com/projects/jquery-bbq-plugin/) with great success. This and the jQuery Templating engine would be great for what you are trying to accomplish. If you change the url of the browser this will automatically perform a redirect and refresh the entire page. You could use the hash sign ( # ) which doesn't trigger a refresh. For

.NET MVC 4 JSON Post/Put char limit in Web.config

可紊 提交于 2019-12-02 11:02:56
问题 I am using the PUT verb to send JSON to a MVC controller. When I reach a certain limit I get a 500 error. If I scale back the JSON I send, then it sends just fine... Does anyone know of a configuration in the web.config that will allow a larger amount of JSON to be passed to my application? 回答1: Here is the answer... My JSON object was quite large so .NET wouldn't allow it to pass due to a "security feature" The default is 2000, so I bumped it and it worked perfectly. <add key="aspnet

jqGrid row update

吃可爱长大的小学妹 提交于 2019-12-02 10:49:13
does anyone have a link to an asp.net mvc 2 c# sample which contains saving rows to the server? how do you post the results back to a db? Check out those two sample applications: jqGrid in ASP.NET MVC 3 and Razor jqGrid in ASP.NET MVC - Strongly typed helper 来源: https://stackoverflow.com/questions/5335766/jqgrid-row-update

System.MissingMethodException: No parameterless constructor defined for this object

╄→尐↘猪︶ㄣ 提交于 2019-12-02 10:47:25
问题 I'm using MVC 2.0 with a Html.ListBoxFor as below: <% using (Html.BeginForm()) { %> <input type="submit" value=">" /> <%= Html.ListBoxFor(x => x.lstTest, new MultiSelectList(new [] {"someone", "crap", "why"})) %> <% } %> When I click the input submit button below with nothing selected, it posts back fine, when I select one of the 3 items in the listbox it throws this error: System.MissingMethodException: No parameterless constructor defined for this object. Any ideas? here is my controller

Why is EditorFor in my ASP.NET MVC 2 application throwing ArgumentNullException?

那年仲夏 提交于 2019-12-02 09:55:07
I have a weird problem with EditorFor in one of my views. The following code throws an ArgumentNullException. <%: Html.EditorFor(x => x.Name) %> However, the following code is fine. <%: Html.TextBoxFor(x => x.Name) %> Model.Name is a string variable - and it's set. EditorFor works in another view - until this view crashes, at which point then I have to restart the development web server (Cassini) or all the EditorFor calls crash with the same message. I ran a test with the MVC 2 source, hoping I could get some insight, but that worked OK! Presumably the MVC 2 RTM source on there should be the