asp.net-mvc

Problem with link styling failures in ASP.NET MVC

I have an ASP.NET MVC application that has a jQuery Treeview and a jQuery Splitter in it. There is a header at the top. Below that, the splitter is used to separate the space into two divs. The left div contains the treeview, and the right div contains the content. I have a stylesheet just for the content area; all of the styling is ...

ASP.net MVC Resource Cannot Be Found

I have a PartsController with the following partial code: Function Search(ByVal searchtext As String, ByVal SearchType As String) As ActionResult If SearchType = "PARTNAME" Then Dim SearchResult = From p In _entities.PartList _ Where p.PARTNAME = searchtext _ Select p Return View() End If If SearchType = "NSN" Then Dim SearchResult = ...

Retrieving data from a one-to-many relationship

I'm trying to retrieve data from a one-to-many relationship, in an ASP.NET MVC application. Let's say I have two tables Posts and Category with the following attributes: posts -id -title -category_id category -id -name -author I want to grab posts that belong to a category and grab the values of .name and .author from the category. T...

Custom validation with Data annotations

Hello I'm using dataannotations to check data thats being entered, but I'm stuck when it comes to more custom way to validate data. I need to run queries against database to see if stuff exists there or not, and then report back to user if a "custom db-check error" appears, such as "The Companyname already exists" How can I implement...

The order of elements vary in an Iquerable, every time I query with the same condition

I am working on a ASP.NET MVC application where we have to write our own code for paging. And I see elements getting repeated on different pages. This is happening because the order of elements in the Iquerable varies randomly and one have to query the database for each page. I solved this problem by ordering the elements by date of cre...

Where to catch exceptions from customized ModelBinder

Hi all, I have a customized ModelBinder which bind web from with a object using code like this" [ModelBinder(typeof(CustomizedModelBinder))] public class Widget{ ... } This modelbinder may throw exceptions and where should I add code to catch those exceptions? Thanks in advance! ...

Cannot get T4MVC to work with VS2010 and ASP.NET MVC 2

I'm trying to add the T4MVC templates to my project, but I'm experiencing some problems. I went to Codeplex and downloaded the latest version of T4MVC, and according to the instructions I just copied the two files T4MVC.tt and T4MVC.Settings.t4 into the root of my web application. Immediately, I got the following errors: From T4MVC.cs ...

how post more rows

[AcceptVerbs(HttpVerbs.Post)] public ActionResult Edit( string id_stud) { ViewData["stud"] = id_stud; return View("temp"); } temp.aspx: <h2><%= Html.Encode(ViewData["stud"]) %></h2> This page shows only one student. How to display other students? ...

Testing the Create in a Controller

Hi All, I am very new to Testing and MVC.NET, and I have some code in the Create of the ArticleController which I wish to test, however I need some help because at the moment I am kind of stuck. My Code is as follows :- if(ModelState.IsValid) { try { if (!User.IsInRole("Administr...

Is memory management a concern with asp.net mvc

Hai guys, I want to know,is memory management a concern with asp.net mvc.. comparision of memeory management in both asp.net mvc and web forms by experts ...

Impersonating a Remote object

I have a web application in which web server acts as a remoting client. Here I am creating CAOs using SAO. I want to impersonate the client who logs into the web application on Remoting Server. While I am able to impersonate the client objects created by SAO object factory, but using these objects method calls are not getting impersonate...

how to allow a user to upload a spreadsheet in asp.net mvc

i want a user to have file picker and then choose a spreadsheet which will then be parsed by a controller action. are there any examples of how to do this? ...

ASP.NET localhost routing issue

A call to localhost ( using the VS 2008 integrated webserver ) is not working ( empty page.. ) http://localhost:6666 but a call to a remote IIS http://asdf.com/MyApp is routed to the correct controler and method (SearchController -> Search )... MyApp is the IIS directory in which the folder "Controller" is... The routingcode: ...

ASP .NET MVC, Unknown runtime error in IE (nested forms)

Hello! i have view which looks something like this : <% using (Ajax.BeginForm(new AjaxOptions { UpdateTargetId = "someDiv", HttpMethod = "Post")) {%> <%= Ajax.ActionLink("Add new", "AddNewItem", new AjaxOptions { UpdateTargetId = "divAddNewItem", HttpMethod = "Get" })%> <div id="divAddNewItem"> </div> <input type="submit" valu...

Using ASP.NET MVC and jQuery to render partial view/submit a form without page refresh

Hi, I'm new to ASP.NET MVC and jQuery, so I thought I'd share how I implemented loading of partial views and submitting forms in a way that doesn't require for the entire page to be refreshed. I hope to get some critique from the experts if there's a better way to do this :) All the magic is done by 3 javascript functions which I bin...

ASP.NET MVC: converting virtualpath to actualpath is wrong

Hi there, I have been using Url.Content inside <% and %> in my views and all seems to be working fine... Then from withing my controller i have tried the following, but it always returns the wrong path XDocument xdoc = XDocument.Load(Url.Content("~/content/xml/faq.xml")); and XDocument xdoc = XDocument.Load(VirtualPathUtili...

asp.net MVC Database call in partial view

I would like to make a database call in a partial view in asp.net MVC. I am not sure how to actually go about that. I am trying to get an instance of the repository so I can make a couple calls to the DB to build some info on the page. Not sure if I am even close but does anyone have any ideas ? <%@ Control Language="C#" Inherits="Sys...

How can I learn to stop worrying and love ASP.NET MVC Forms?

MVC encourages RESTful URL's, yet HTML forms by nature append the data in query string values. My action takes "text" as a string parameter. And my form is: <% using(Html.BeginForm("Action", "Controller")) { %> <%= Html.TextBox("text") %> <input type="submit" value="submit" /> <% } %> My action is: public ActionResult Action(stri...

How to handle different ActionResults for an ASP.NET MVC Controller Action

I have a not-so-ideal situation where uploaded files are stored on an internal network share. So in the database I'm storing the path to where the file was saved, but it's quite possible for the file to get deleted out of sync of the database. So in a Controller action I lookup the upload information and perform checks that things are ...

Setting the selected item of a drop down list in view code

Hello I have a loop creating a form in my view code. Within the form each item has its own drop down list which they all share from the view data: <%foreach(Foo i in Model){ %> <tr> <td><%=i.title%></td> <td><%=Html.DropDownList("order"+i.id.ToString(), ViewData["SequenceDropDown"] as SelectList)%></td> </t...