I have a background service running which sends out emails to users of my website. I would like to write the email templates as MVC views, to keep things consistent (so that the same model can be used to send out an email as to display a web page).
Unfortunately, when I try to do a LoadControl (which simply patches through to BuildMana...
Still new to NHibernate. I'm using NHibernate 2.1.2 and the Linq provider.
I am wondering where I should put my business rule logic. For example, I have an entity called Service with DateTime property. In my web app, I only ever want to display/work with services whose DataTime is less than 4 weeks away. Where should I put that rule?
I...
I am working on a VB.NET project which is using ASP.NET MVC 2. I am taking advantage of the ability to add validation and other attributes to the metadata in my model.
For example, I have added attributes such as <DisplayName("Full Name")> to the properties in my model and am rendering these using the Html.LabelFor () extension method....
Hello SO:
I am writing an MVC application, and I wanted to do some extra formatting so the phone numbers all are stored the same. To accomplish this I made a simple external function to strip all non-numeric characters and return the formatted string:
public static string FormatPhone(string phone)
{
string[] temp = { "", "", "" };...
Hi,
We need to generate forms for Create/Display/Edit on our website. The requirement is that these need to be metadata driven. We will have properties on our Model attributed with the type of control to generate for that property.
[RenderAs("DatePicker", Order = 1)]
public DateTime DateOfBirth{get; set;}
The idea is to have templa...
here is the call...
return new FileUriResult("application/octet-stream", a.AssetPath, null);
[note that I set content length to null because I don't know it (file is on another server)]
a.AssetPath is: "http://http.cdnlayer.com/account name/folder/folder/folder/asset.mp3"
(fake URL for this example but in my implementation I can bro...
Is it possible to use HTMl.RenderAction using ajax to provide the parameter?
I have a controller action like this
[ChildActionOnly]
Public ActionResult EmployeeData(string id)
{
Employee employee = new Employee();
//do work to get data
Return PartialView(employee);
}
The partial view is just a small table with some empl...
Hi, I have two tables Category 1..* Advertisement.
I want to get the advertisements Count for each category. To do so, I use that query:
var catList = (from c in DB.Category.Include("Advertisement")
select new { c.Name, c.Advertisement.Count }
).ToList();
How to access the e.g the first element's p...
I'm trying to build a link to an external website using some properties of my model class in my view page, e.g. I want it to render as something like -
< a href="http://twitter.com/home?status=Currently reading http://www.mywebsite.com/post-id">Twitter < /a>
where post-id would be pulled from the model (I'm using a strongly typed view ...
In asp.net mvc 2 view i am trying to render something if true.
In code below i am trying to use Html.Encode(x) to render value into page but it does render nothing. What is wrong with if statement with html.encode?
Works
<%if (!ViewData.ContainsKey("DisplayQtyPrice")) {%>
<%: entry.Amount %>
<%}%>
Does not work
<%if (!ViewD...
I have an index page for listing products. From this page I would like to be able to open a dialog with the following tabs. Edit/Create Product, Product Images, and a tab for Brands. The brands tab isn't specific to the product being edited/created, and doesn't require being passed an ID. I have everything broken up into the following pa...
I have a ControllerBase class in an ASP.NET MVC Application. The other controllers inherit from ControllerBase.
I want to access HttpContext.User.Identity.Name, but HttpContext is null. What's the matter?
public ControllerBase()
{
var dataManager=new DataManager();
if (HttpContext.User.Identity.IsAuthent...
I have an ASP.Net site (happens to be MVC, but that's not relevant here) with a few pages I'd like cached really well.
Specifically I'd like to achieve:
output cached on the server for 2 hours.
if the file content on the server changes, that output cache should be flushed for that page
cached in the browser for 10 minutes (i.e. don't...
Hello. I'm about to begin building a website using the ASP.NET MVC framework and I'm trying to find a good solution to 1)Source Control Management and 2)Deployment. For the SCM, I'm probably going to use SourceGear since it integrates into Visual Studio nicely, but for deployment, I don't even know where to start. Up until know, most ...
how do i append or get variable to server side function from MVC application after HttpVerbs.Post?
in client side code:
<input type="hidden" id="hidPopUpMsg" name="hidPopUpMsg" class="hidPopUpMsg" value="" />
<% Using Html.BeginForm("SelectedProvider", "Scheduling", New With {item.PRVNO, .PhoneNumber = item.PPHON, .FaxNumber = item.PP...
I have an enum for one of the properties of my view-model. I want to display a drop-down list that contains all the values of the enum. I can get this to work with the following code.
What I'm wondering is whether there is a simple way to convert from an enum to an IEnumerable? I can do it manually as in the following example, but wh...
I've put together a snippet of code in ASP.NET MVC in which I'm trying to use the addClassRules methods of jQuery's validator. From what I can tell I'm taking this straight of the examples on
http://docs.jquery.com/Plugins/Validation/Reference
But the page is just submitted it doesn't show any errors. I would like to use the "addClas...
Hi Everyone,
I'm trying to send an image file to a web service.
here's my code:
ConnectionFactory connFact = new ConnectionFactory();
ConnectionDescriptor connDesc;
//String value = new String(data);
String value= Base64OutputStream.encodeAsString(data, 0, data.length, false, false);
value = "imgDa...
Can someone please show me the easiest way to create/update a parent and child record at the same time (like customer with multiple addresses) with least or no code as possible? Both Web Forms and in MVC.
...
I'm not even quite sure where to start explaining this problem. I've been working on this for about the past 10 hours without a clue as to what the root cause is. If any additional details are needed, I'd be happy to provide. I'm just guessing at what is relevant at this point.
I have an MVC2 site with routes set up by by Steve Hodgkiss...