Hi All,
I am new to MVC and facing one issue.
I have a xml file and i am retrieving its value using Linq to xml and assigning it to ViewData.
Controller.cs
var res=from x in doc.Descendants("person")
select new
{
Fname=x.Element("fname").Value,
Lnam...
Hi
I am using Linq2Sql and want to bind an objects field (which is enum) to either a bit or a int type in the database. For example I want have a gender field in my model. I have already edited the DBML and changed the Type to point to my enum. I want to create Radio buttons (which I think I have figured out) for gender and dropdown lis...
I have a from on my page as follows:
<% using (Ajax.BeginForm("AddAnswer","Marketplace",new AjaxOptions()
{HttpMethod = "POST" })){ %>
AddAnswer action adds some data to db. What I want to do is: when answer has been successfully added, append #answers div with the current answer passed to controller. When answer has not been suc...
I encapsulate my linq to sql calls in a repository class which is instantiated in the constructor of my overloaded controller. The constructor of my repository class creates the data context so that for the life of the page load, only one data context is used.
In my destructor of the repository class I explicitly call the dispose of the...
I just upgraded a .NET 3.5/ASP.NET MVC 1.0 project to Visual Studio 2010. The upgrade utility tried to switch all of my references to ASP.NET MVC 2.0, which is not what I want to do at this point, so I had to change several project references and the web.config file back to use ASP.NET MVC 1.0.
Right now, I have the solution building a...
I have a few ActionLinks that when rendered are getting a length key/value added that appears to indicate the number of characters of the controller name. How can this be removed?
...
I have a form to enter subcontracts. On this form I have a dropdownlist of all companies in the system. Next to it is a button "Create Company". This button opens a jquery dialog which allows the user to create a new company. Once the dialog closes, the new company needs to be added to the dropdownlist and selected. If I refresh, it...
I want to render the same view after a successful action (rather than use RedirectToAction), but I need to modify the model data that is rendered to that view. The following is a contrived example that demonstrates two methods that that do not work:
[AcceptVerbs("POST")]
public ActionResult EditProduct(int id, [Bind(Include="Uni...
Serious n00b warning here; please take mercy!
So I finished the Nerd Dinner MVC Tutorial and I'm now in the process of converting a VB.NET application to ASP.NET MVC using the Nerd Dinner program as a sort of rough template.
I am using the "IsValid / GetRuleViolations()" pattern to identify invalid user input or values that violate bus...
I am trying to add the path /_vti_bin/Lists.asmx to my ASP.NET MVC 2 web application.
I am registering the route as follows:
routes.IgnoreRoute("{resource}.asmx/{*pathInfo}");
routes.Add(new Route("_vti_bin/Lists.asmx", new ListsHandler()));
where ListHandler is defined as:
public sealed class ListsHandler : IRouteHandler
{
#reg...
I have an MVC 2 application that has the following on it;
<% using( Html.BeginForm("Results","Quote", FormMethod.Post, new { name="Results" })){ %>
<% Html.RenderPartial("Needs", Model.needs); %>
<div class="But green" style="">
<a href="." onclick="javascript:document.Results.submit();">Go</a>
</...
I'm having some problem with passing a javascript array to the controller. I have several checkboxes on my View, when a checkbox is checked, its ID will be saved to an array and then I need to use that array in the controller. Here are the code:
VIEW:
<script type="text/javascript">
var selectedSearchUsers = new Array();
...
Hi folks,
Is it possible to step through the official ASP.NET MVC 2 code via using the Symbol Server thingy in visual studio 2010?
I know I can download the full open source MVC code from codeplex, build it and then get my code to reference THAT codebase dll's...
But i'm wondering if this could be achieved by using the Symbol Server s...
I am trying to call the RenderAction Extension Method within my own Html Helper:
System.Web.Mvc.Html.ChildActionExtensions.RenderAction(helper, "account", "login");
this is so that along with some additional logic, I would like all html helpers to use a common method name structure when calling it on the view:
<%= Html.CompanyName()....
What are the key points to be considered when deviding the .edmx (Entity framework) to multiple files for a large database?
...
Hi everyone,
I have a simple but heavily used app done in VS2010/MVC2. I didn't like having separate folders for each view/controller and so have all the views in the Shared folder. It's working fine but while debugging in VS, I noticed that it's throwing IO "caught exceptions" since it seems to be looking in the [FolderName]/[ViewNam...
Hi all,
I am using ASP.NEt MVC . I want to upload .zip files for which I am using html input file upload control on my view.
I want only .zip files to be uploaded.
I want to check that my .zip contains only two files - both having extensions .txt and one of them having name "start".
Can anyone please suggest me about how to check this...
Hi,
I have a question about unit testing.
Say I have a controller with one create method which puts a new customer in the database:
//code a bit shortened
public actionresult Create(Formcollection formcollection){
client c = nwe client();
c.Name = formcollection["name"];
ClientService.Save(c);
{
Clientservice would call ...
I am working on building an MVC frontend for a CMS system. The CMS system will serve ASP.NET MVC with pages and content.
In Global.asax I registered a custom route handler like this:
public class MvcApplication : EPiServer.Global
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.Add(new Route("{*data}...
How would I write the following ASP.NET MVC C# code in VB.NET?
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master"
Inherits="System.Web.Mvc.ViewPage<MvcGridSample
.ViewModels.Shared.Grid<Customer, CustomerSearchForm>>" %>
...