asp.net-mvc

Accessible <label> in MVC

Given the following MVC mark-up: <p> <label for="forenamesLabel">Forename(s):</label> <%: Html.TextBoxFor(model => model.ConsultantRegistrationDTO.Forenames) %> <%: Html.ValidationMessageFor(model => model.ConsultantRegistrationDTO.Forenames, "*") %> </p> How is it possible for me to accurately set the ...

Execute HtttModule for extionsionless URL only

I have an httpModule which has to run before an ActionMethod. I dont want that it is executed when a request for an image comes in. For some reasons I realy need an HttpModule and cant use an ActionFilter What is the way to do this? public class PostAuthenticateModule : IHttpModule { public void Init(HttpApplication app) ...

How to best integrate HTML/design with C# code in ASP.Net or ASP.Net MVC?

We're working on a new ASP.Net site. The last major site we did was in classic ASP--the procedure we used there was to have the HTML completed first, then "bring it to life" with the ASP code. In the ASP.Net world, how does this work? I.e. how do the designers do their work if much of the mark-up is actually being generated by the ser...

ASP.Net MVC Database Driven Menu Strange HTML output

I have a database driven menu Helper that gets called from within my master page: <div class="topBar"> <%= Html.MenuTree(39, false, "first", "last") %> <div class="clear"></div> </div> Below is the code that outputs my HTML unordered list. The problem is that sometimes the output of the menu is completely wron...

Does someone have real project experience using asp.net mvc implement complicated web UI app?

In my past projects I've been using webform to implement windows form style complicated backend admin page by using asp.net webform. Just wondering by using asp.net mvc, can it make this kind of complicated UI page much easier? ...

Modifying properties in object with LINQ and functions Lamba

Friends, I know how to deploy and retrieve a single element in LINQ, but how can I do to change all the properties in a list. In the line below, I can only modify a record, I would modify several. _ListaAcaoMenuInfo.Where(p => p.Id_acao == id).FirstOrDefault().Id_menu = 0; Thanks ...

xVal ignoring fields that are hidden

I have a form where a user can toggle receiving funds either via check or via electronic transfer. When they choose either way in a list box, the respective part of the form hides. If they choose electronic transfer only bank info fields show, if they choose via check only address info shows and the bank fields are hidden. Well, since ...

enum classes MVC calling from controller

if i create my enum class in the global.ascx in MVC, is there a way i can call that class from a controller. ie i do this in my global.ascx class volume myVolume = volume.Low is there a way i can find out what i set myVolume to from a controller. ...

Best practice for using web services (ASP.MVC)

Basically what I have is web services returning data in xml format. Once I do a call to a webservice to retrive data from web service function (GetUserList) i want to take that data and then dymaically display (no postback) the resulting information. I know several ways of doing this: webservice sends data back to javascript, javascript...

Form File Upload with other TextBox Inputs + Creating Custom Form Action attribute

Hi All, I am attempting to create a form where a user is able to enter your typical form values textboxes etc, but also upload a file as part of the form submission. This is my View code it can be seen that the File upload is identified by the MCF id: <% using (Html.BeginForm("Create", "Problem", FormMethod.Post, new { id = "ProblemFor...

Choosing the MVC view engine

I want to allow the end-users of my web application to modify views (via web based back office), stored in the database. The desired view engine is expected to be code-injection safe, meaning that the end-user will be limited to the absolute minimum number of expressions available, no server code inserts are allowed. Is any suitable vie...

iFrame suppress authentication popup for https when parent window is already authenticated

I've developed a print mechanism for an intranet application running over HTTPS. Using javascript and jQuery I create an iframe in the page and populate it with all the dynamic data that should be printed. The iframe has a source of /MyController/Print which just returns a blank dummy page. This is then replaced with the dynamic content...

How do I add an additional route?

Here is my default route. context.MapRoute( "CreditReview", "Site/{sitecode}/CreditReview/{controller}/{action}/{id}", new { action = "Index", id = "" } ); I'm looking to add 'status'. This is what I currently have and it isn't working. I haven't worked with routes before so I'm sorry if this is an easy question to answer. context....

MVC Page not showing up, 404 not found

I have a very simple MVC site that is returning a 404 not found error when trying to load a page at the very beginning. I'm looking for some direction to troubleshoot this problem since there is really nothing to go on from the error message. UPDATE: The problem appears to have been cause by me setting the start page by right-clicking ...

Is it OK to create the HTML first for an ASP.Net or ASP.Net MVC site?

Does it work OK to code the HTML first for an ASP.Net or ASP.Net MVC site, and then hand this off to the coders? If not, what would be the best approach to integrating these? ...

Validation firing in ASP.NET MVC

I am lost on this MVC project I am working on. I also read Brad Wilsons article. http://bradwilson.typepad.com/blog/2010/01/input-validation-vs-model-validation-in-aspnet-mvc.html I have this: public class Employee { [Required] public int ID { get; set; } [Required] public string FirstName { get; set; } [Required] ...

How to dynamically load aspx code from a database?

I have content like this stored in a database <p>This a sample text. <%= Html.ActionLink("test", "myaction", "mycontroller") %></p> The content is part of my data repository, that is the reason I want to keep it inside the database. I would like to know how it is possible to render it and execute it at compile time. I am using it on ...

How to unpack htmlAttributes in a span tag in ASP.NET MVC

I have htmlAttributes generated - originally for the purpose of creating a link with the attribute using Html.ActionLink. Now, based on some condition, I would like to create a <span> tag instead and put the attributes in there. Is there anyway it can be done easily ? Eg: something like: <span <%= htmlAttributes.Unpack() %> > Some txt...

LINQ to SQL: making a "double IN" query crashes

I need to do the following thing: var a = from c in DB.Customers where (from t1 in DB.Table1 where t1.Date >= DataTime.Now select t1.ID).Contains(c.ID) && (from t2 in DB.Table2 where t2.Date >= DataTime.Now select t2.ID).Contains(c.ID) select c It doesn't want to run. I ...

in asp.net mvc is it possible to register routes somewhere other than application.Start()

Hi, is it possible to create and register routes after Application.Start() is called? let's say have a controller, PersonController. With default routing, URLs could look something like www.site.com/Person/Edit/4, with 'Person' matching the controller. now imagine I have several users, some may prefer we use the term 'Friends'. I wo...