I'm using following code to display some text and it won't change the font color, anyone know why?
<%= Html.TextAreaFor(m => m.Component.ApplicationDescription, new { cols = "40%", Style = new Style { ForeColor = Color.Red } })%>
...
Is it really efficient to render HTML in cs file . i am talking about the efficiency only?
Html helper approach in the mvc is the samething or not? rendering html in the cs file
...
This method seems stupid and a bit heavy; is there a more optimal way of creating the same thing (its for an MVC View Dropdown)
private List<KeyValuePair<int, string>> getMonthListDD
{
get
{
var dDur = new List<KeyValuePair<int, string>>();
dDur.Add(new KeyValuePair<int, string>(1, "January"));
dDur.Add(n...
I have the following two lines of codes in my model, however, both virtual and path have values "\". Where have I gone wrong?
var virtual = VirtualPathUtility.ToAbsolute(HttpContext.Current.Request.ApplicationPath);
var path =HttpContext.Current.Request.ApplicationPath;
...
Hi,
I am trying to use an Entity Framework Model (in separate project) into an asp.net 4 MVC project (VS2010, C#)
If I create the EF inside the MVC project I have no problems.
I think I am missing some step.
things done:
1. added reference to the EF class project
2. added connection string in MVC web.config
3. added reference to System...
Hi
I recently started evaluating ASP.NET MVC. While it is really easy and quick to create Controllers and Views for Models with only primitive properties (like shown in the starter videos from the official page) I didn't find any good way to work with references to complex types. Let's say, I have these Models:
public class Customer { ...
looking at different sites, i see conflicting conventions.
if you want to have links to images, other pages, js files, i have seen:
URL.Content("~/scripts/myscript.js");
<a href="/scripts/msscripts.js">
<img src="../../images/test.jpg" />
<img src="../images/test.jpg" />
<img src="/images/test.jpg" />
<img src="~/images/test.jpg" />
...
Hi,
in my unit test, the ViewResult.ViewName property is always empty when i use the action name for the view:
return View(model);
or
return View();
Is that by design?
...
i have some html files as part of a regular website that has been ported over to asp.net mvc. In my code i need to read and write these html files and stick them in a tinymce editor
To be able to read and write this file from disk in the past i had a hard coded path but this doesn't seem to work in asp.net mvc unless i do something li...
Hi,
I need a field that displays the datepicker. I followed the example given by the JQuery UI documentation and haven't managed to get it to work. My html where I have my text field is:
<div class="editor-field">
<input type = "text" name = "DatePublished" id = "Published" />
<%= Html.ValidationMessag...
The Model object refuses to update on production server but has no issues on development machine. For the purposes of testing, I retrieve the model object and then immediately check its validation and update states, for example:
Timesheet timesheet = _timesheetRepository.GetTimesheet(timesheetId);
Helpers.ErrorHandler c...
I've raised this question before but am still struggling to find an example that I can get my head around (please don't just tell me to look at the S#arp Architecture project without at least some directions).
So far I have achieved near persistance ignorance in my web project. My repository classes (in my data project) take an ISession...
Hello,
I'm using an helper class that I called CreateEditOrganizationService where I put all the helper methods. In my controller, I've createService as object of that class. So far, I've got 5 methods. Now, I've just defined a 6th method called Set_TypeOrganization.
I'm getting the Set_TypeOrganization in the intellisense, but after ...
Hi
I have a [Range] annotation that looks like this:
[Range(0, 100)]
public int AvailabilityGoal { get; set; }
My webpage looks like this:
<%=Html.TextBoxFor(u => u.Group.AvailabilityGoal)%>
It works as it should, I can only enter values between 0 and 100 but I also want the input box to be optional, the user shouldn't get an vali...
Hi,
Did someone create a nice stylesheet for this:
http://mvccontrib.codeplex.com/wikipage?title=Grid&referringTitle=Documentation&ProjectName=mvccontrib
Thanks.
Christian
...
I have a MVC application that works on cassini, works on IIS 6, but I have issues with in IIS 7. I think my issue has to do with how IIS 7 handles threading in a integrated app pool. So to test my theory I'm trying to get my MVC app running in classic mode on IIS 7. I set my app pool to classic and I add a wildcard script for aspnet_i...
given this code
namespace GridTests
{
public class Grid<T>
{
IEnumerable<T> DataSource { get; set; }
IList<Column> Columns = new List<Column>();
class Column
{
public string DisplayText { get; set; }
Func<T, object> Rowdata { get; set; }
}
}
}
I need to be ab...
here is my view code:
<%=Model.HtmlData %>
here is my controller code:
public ActionResult GetPage()
{
ContentPageViewModel vm = new ContentPageViewModel();
vm.HtmlData = _htmlPageRepository.Get("key");
return View(vm);
}
my repository class basically queries a database table that has the fields:...
I'm trying to do a join like this using fluent nhibernate:
Id(x => x.Id);
Map(x => x.SourceSystemRecordId,"sourceSystemRecord_id");
Then
Join("cat.tbl_SourceSystemRecords", SourceSystemRecords);
But, it seems I don't have a way to specify the column I want to join with from the first table, in this case I need to join on SourceSyst...
I'm fairly new to ASP.Net MVC 2 and understand the MVC pattern in itself. But my question is what's the best way to populate dropdownlists in the UI sticking to the MVC pattern. Should I be going through the controller?
Every article I've seen to do this shows how to do it using javascript and jquery. I have a test application that I'...