What's the best way to provide shared data to my views?
For example, I want to be able to just put <%= Model.Title %> in my master page, or something similar.
In that scenario, is it better to override the ViewPage classes I need? Or just use a shared model object?
I'm currently trying to do the shared model object approach -- it work...
Hi
I have some questions about some things in Asp.net MVC that still confuses me.
a. I am still confused when I should be using <%= %> and when I should use this <% %>(this one seems to need a semi colon at the end).
b. How can I fix this in VS2008? When I make a partial view and I start typing say <%= intellisense assumes I meant thi...
Hi
I been reading on asp.net mvc learning site about JavaScript injection and man it is an eye opener.
I never even realized/thought about someone using JavaScript to do some weird ass injection attacks.
It however left me with some unanswered questions.
First
When do you use html.encode? Like do you use it only when you are going t...
So far, the only successful strategy I've been able to get by with is the following:
Configure YOURAPP.Web to "Use Local IIS Web Server" and set "Project Url" = http://localhost/yourapp.web
Click "Create Virtual Directory"
In IIS Manager ensure that "Classic .NET App Pool" is selected
Add wildcard mapping * named "ASP.NET-MVC" that ...
In order to dramatically reduce the number of HTTP requests on my ASP.NET MVC website, I am programmatically merging the files.
Essentially, I have an MVC URL http://localhost/Optimisation/JavaScript/ that calls my controller. The controller reads the javascript files in a certain order, merges them into a single output and renders it o...
We're using a FileStreamResult to provide video data to a Silverlight MediaElement based video player:
public ActionResult Preview(Guid id) {
return new FileStreamResult(
Services.AssetStore.GetStream(id, ContentType.Preview),
"application/octet-stream");
}
Unfortunately, the Silverlight video player downloads the ...
So I have this .resx file and I want its values shown in a drop down list in ASP.NET MVC (C#).
Is this possible? Google couldn't help me, so I hope SO can :-)
...
I'm creating a solution where I have several projects, each of them having the responsibility of dealing with entities, MVC views and controllers of a certain kind. That is, one deals with accountance, another with company management, etc. This allows us to reuse them in multiple solutions.
I'm able to use the views in the different ass...
I know the easy way to get to an SSL page in ASP.NET MVC - via the [RequireSSL] attribute but I'm a little confused to the best way to do the opposite.
I have many links on my site in a header bar and most of those links don't require SSL and I don't want to still use SSL.
The futures project makes it very easy to redirect automaticall...
Hello,
I'm designing medium-size website using asp.net mvc technology.
All business logic is organized into IServices (like IDomainService, IUserService, IAuthService, ITrainingService). All services are using IRepositories.
I'm using Ninject 1.5 to wire services with controllers and it seems working perfectly.
There is so far one subj...
(Tried to post this on the ninject google group but it didn't show up so far, a few hours later..)
I have started using Ninject 2 (downloaded from Github yesterday including the MVC extension project) with a project based on the following technologies;
.Net 3.5 Sp1
ASP.NET MVC 1.0
LINQ to SQL
Nothing magical here - I have a few repo...
Hi
I am using Asp.net MVC and I been trying to use Ajax UI tabs in jquery.
On the demo site: http://jqueryui.com/demos/tabs/#ajax
It has this
Fetch external content via Ajax for
the tabs by setting an href value in
the tab links. While the Ajax request
is waiting for a response, the tab
label changes to say "Loading...",
...
Hello, I have a model got from a sql 2008 database, now i need, in the same model file to create a entity that represent a user-base from another database. How I can do this in the same model and avoid creating a database view.
...
I'm currently in the process of learning ASP MVC and am running into a few issues.
First, when I use
<%=Http.ActionLink("Add / Modify", "AddModify" %>
it will show as Add / Modify (/Home/AddModify) in Firefox and Add / Modify in IE. It is doing that to all links in FF and none in IE. Anyone know what reasoning is for that?
Edit: ...
I have two radio buttons on my MVC form that I use to hide or show a row in a table.
It works fine in firefox, but not IE. It seems that in IE the JQuery function is only being fired when i select the first radio button. i have added extra radio buttons to confirm that it only fires on the first.
To render my buttons:
...
I am looking for method to disable Browser Cache for entire ASP.Net MVC Website
I found following method,
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Response.Cache.SetNoStore();
and also meta tag method, ( It wont work for me , since some MVC Actions send partial html/json through ajax, without head,meta tag...
Is there a simple way of generating a new Route-URL without all this faff.
I'm currently Handling several routes to the same view, all of which end with
/{pagenumber}
All I'm trying to do is delete everything back to the last backslash and replace the number.
I was trying to avoid using the URL Maker as it seems a tad overkill for pa...
In site.master view, I have some inline code like:
<%=(ViewData["Name"] as Model).Name %>
If ViewData["Name"] is null, the code above will cause exception. Then I want to show the customized error view to user. What I did is set error mapping is web.config like:
<customErrors mode="On" defaultRedirect="~/Error/Unknown">
<e...
In reporting tools like Crystal Reports, there are ways to take denormalized data and group it by a particular column in the data, creating row headings for each unique item in the specified column.
If I have this:
Category1 Data1
Category1 Data2
Category1 Data3
Category2 Data4
Category2 Data5
Category2 Data6
The re...
In asp.net MVC I have a search action in my controller and I am trying to decide If I should pass the query to my repository as a string
public ActionResult Search(string query)
{
return View(_repository.ListPeople(query));
}
or as individual parameters:
public ActionResult Search(string FirstName, string LastName, System.Nullabl...