I am using MVC, not that this makes a difference, but I have a text box for searching.
<% using (Html.BeginForm("Index", "Search", FormMethod.Post)) { %>
<%= Html.AntiForgeryToken() %>
<div id="search_box">
<span id="search-title">Search Site</span>
<div>
<%= Html.T...
I have a route defined as:
routes.MapRoute("AllUsers",
"Users/Search/{Search}", new {
Controller = "Users", action=
"Index"});
and the form as:
<% using (Html.BeginForm("Index", "Users/Search/", new { RouteValue = "AllUsers" }, FormMethod.Get, new { id = "searchForm" })){%>
<input id="searchBox" name="search" type="text...
I have a generic repository that I communicate with my object context with. My object context has function imports that I want to be able to call through my generic repository. Currently I call them through an "Execute" function, but this is not ideal because I have to pass in my function name and parameters as strings which can cause r...
I am trying to follow the Nerd Dinner MVC application as a base to learn the correct way to develop MVC applications.
I have created Interfaces and Repositories as the reference code suggests and am using Entity Framework for data access.
If I want to insert data when a user registers into a table [dbo].[Users], I do not have a control...
I have developed an ASP.NET MVC (version 2 RC) application with a ton of jqGrids. It's working like a champ in Firefox, but I've discovered a problem in IE8.
The "Main View" grids can be filtered by a search box or one of a few dropdowns above the grid. I use some javascript to reset the url for the grid, then trigger a reload, thusly...
What is the proper way to encode URLs in anchor tags in an XHTML/Strict document:
<a href="http://www.sit.com/page/<%= HttpUtility.UrlEncode("String that might contain unicode and dangerous characters like +, /, \\, <, >, \", ', =") %>">
Anchor text
</a>
or
<a href="http://www.site.com/page/<%= HttpUtility.HtmlEncode("Strin...
I just setup an out of the box "W2K8 R2 Web" server and installed IIS 7 out of the box. Then I installed the .NET4 framework and ran "aspnet_regiis -i" command.
I created a site using .NET 4.0 Integrated app pool.
I created an MVC application using the default MVC project template, without modifying I compiled the project and deploy th...
Hi!
I'm building a site where i need to be able to notify a user on each page. The function is going to look alot like what StackOverflow is using, the yellow(orange?) border at the top. I dont want to reproduce this logic inside all of my actions. DRY.
I'm thinking about using a action filter, but since i need to query my data layer i...
Recently I started working with MVC, before that I used "classic" ASP.NET.
After using Ruby on Rails (RoR), I wonder how to implement POST request handling in MVC similar to how RoR operates. In RoR you use the Post method, so you need only one function for a view.
In ASP.NET MVC I need to use 2 separate functions for GET and for POST,...
This question builds on the following question:
How to get Elmah working with ASP.NET and IIS 5.1 URL Routing
The solution suggested there worked, as long as elmah.axd is off of the root of the site. What if you want to secure the site as blogged here:
Securely Implement ELMAH For Plug And Play Error Logging?
Moving elmah.axd to /admi...
I have downloaded a MVC project from an Open source and I am trying to make it my own.
I want to change images and add different things, new pages etc...
When I am changing an image in the content folder (for example the logo appearing at the top of the master page) it is always showing the old one.
If I change the name to logo1 for ...
Asking for the best way to address this issue:
in my controller I have the following action
public ActionResult Member(string id){return View();}
another action in the same controller
public ActionResult Archive(string year){return View();}
in my global.asax
routes.MapRoute(
"Archive", ...
Hello, I'm a little new to DI containers like StructureMap and I've been using it for a short time with asp.net mvc applications. Now I'm splitting my architecture that will have a WCF service layer and a sort of consumers like ASP.NET MVC app, Silverlight App, And Winfors/WPF App. When using SM with asp.net mvc I've been initializing th...
I have a HTML form that mimics invoice input form.
This is the way I load invoice items (users select them thru autocomplete list using jQeury):
$(document).ready(function() {
$("#Products").focus().autocomplete('<%=Url.Action("GetProducts", "Product") %>', {
dataType: 'json',
parse: function(data) {
...
I am creating a example for better understanding.
[CustomValidator("Property1","Property2", ErrorMessage= "Error1")]
[CustomValidator("Property3","Property4", ErrorMessage= "Error1")]
public class MyViewModel
{
public string Property1 {get; set;}
public string Property2 {get; set;}
public string Property3 {get; set;}
pub...
Html.ActionLink appends "Index", the action name to the end of the urls, but i would like to not have the index action listed in the default controller url (hope that makes some sense...)
Not Wanted: /ControllerName/Index
WANTED: /ControllerName
Below is my routing setup:
routes.MapRoute(
null,
...
So if I have a URL such as mysite.com/user/1234/show which object can I use in the view that is displayed to get at the 1234 int in the URL above? For instance I want to have an action link that uses the user id again for the next controller action call such as mysite.com/user/1234/edit.
Thanks
...
I'm looking for one that can be used to handle many long poll clients and does not create a thread for each request.
...
I am using the Authorize attribute like this:
[Authorize (Roles="Admin, User")]
Public ActionResult Index(int id)
{
// blah
}
When a user is not in the specified roles, I get an error page (resource not found). So I put the HandleError attribute in also.
[Authorize (Roles="Admin, User"), HandleError]
Public ActionResult Index(in...
Can you help me? I used contoller HomeConrtoller.cs for view, edit and delete articles. All work, but When I go to the next page I get error don't found http://local.../Articles/1
public ActionResult Articles(int? page)
{
var viewData = mybaseRepository.FindAllArticles();
const int pageSize = 10;
var paginatedArtic...