This throws error:
public static void RenderPartialForEach<T>
(this HtmlHelper helper, string partialName, IList<T> list)
{
foreach (var item in list)
helper.RenderPartial(partialName, item);
}
=>
Error Message: CS1519: Invalid token '(' in class, struct, or interface member declaration
Line 283: #line d...
In ASP.NET MVC, is it possible to define routes that can determine which controller to use based on the data type of part of the URL?
For example:
routes.MapRoute("Integer", "{myInteger}", new { controller = "Integer", action = "ProcessInteger", myInteger = "" });
routes.MapRoute("String", "{myString}", new { controller = "String", ac...
In my view I'm returning some results from a webservice and storing them in a session variable.
Here's the Session Storage Method:
//AreaSummary[] is a reference to the webservice reference gubbins
public AreaSummary[] Results
{
get
{
if (this.Results != null)
{
...
I am using Craig Stuntz article on Using jqGrid with ASP.NET MVC: Search and Formatting, http://blogs.teamb.com/craigstuntz/2009/04/27/38243/
Using HttpFox I can see the json data being returned successfully but it will not display in the grid. The displays fine, but with no data and page numbers. Can anyone see a problem with this
$(do...
I am playing around with the ASP.NET MVC Html.Helpers and I noticed that say for instance:
Html.Textbox("test");
will render the name attribute to "name=test" and the id tag will be "id=test"
But when I do this:
<%= Html.TextBox("go", null, new { @name = "test2", @id = "test2", @class = "test2" })%>
id will be "id=test2" but name...
Suppose I have a view to display the list of employee like:
<table>
<% foreach (var item in Model)
{ %>
<tr><td>
<img name=<%="disp"+item.id%> alt="" src="../../Content/Disp.gif" />
</td></tr>
<% { %>
Then I want to set mouseover and mouseout event for the image to disp the employee info in a popup box.
If the mouse is over the image...
there's any tutorial who explains how to use asp mvc with postgres? (or any other db who don't be MSSQL)
...
I've got a catchall in my base controller that handles errors I don't catch. It goes roughly like this:
protected override void OnException(ExceptionContext filterContext)
{
// Bail if we can't do anything
if (filterContext == null)
return;
// log
var ex = filterContext.Exception ??
new Exception("No f...
I can get at the ViewData and the ViewContext but not the Model.
Any ideas? Do I need to pass the model into the extension method as a parameter? Doesn't seem ideal.
...
I have code in one of my views that looks like this below where if you are logged in, it shows you the welcome notice and if you are not logged in, it shows you a link to the logon page.
<%
if (!Request.IsAuthenticated)
{
%>
<%= Html.ActionLink("Log On", "LogOn", "Account")%>
<%
}
else
{
...
Is there any way to catch a "controller not found" event from the framework?
Maybe this event doesn't exist. But if I just pick a URL to throw at the routing system of the framework like:
http://localhost:54321/foobar
The final result without modification is a 404 error.
Is the easiest way to catch this through a custom ControllerFact...
I am looking to reference my database file in my unit test project. This is an AP.NET MVC app.
Please note: I know I should not be accessing the database in my unit tests but this is for a quick fix on one test that I need to have pass just now.
After the next milestone I will be mocking the database access methods etc.
So here is my ...
I have following ajax call:
var empId = $(this).attr('name').replace(/disp/,'');
$.ajax({
url: '<%= Url.Action( "AjaxDisp" ) %>',
data: { id: empId, format: 'json' },
dataType: 'json',
success: function(data,status) {
// populate the popup and display it
}
});
empId is there(I...
If I want to do an admin function like delete a user on the asp.net membership stuff that ships with the asp.net mvc sample.
I tried looking through the tables and realized that there was multiple tables that had rows added. I assume there must be a simpler way.
...
If the controller action has the OutputCache attribute specified on an action, is there anyway to clear the outputcache without having to restart IIS?
[OutputCache (Duration=3600,VaryByParam="param1;param2")]
public string AjaxHtmlOutputMethod(string param1, string param2)
{
var someModel = SomeModel.Find( param1, param2 );
//set u...
Hi,
I have the following scenario:
1) A phone book table
2) Multiple ways of searching through the table (first name, last name)
3) There is also the obligatory paging (page size and page number) as well as sorting
When the user accesses the page first the Url is simply /Phonebook. Now let's say the user is searching for "abc", then...
I am creating RESTful services for several database entities based on a modified version of the BISDM. Some of these entities have associated lookup tables, such as depicted below:
The lookup tables are associated with one and only one table. Additionally, the lookup tables will be used by the client application to populate dropdown...
I have a business model called Customer which has many required properties (via DataAnnotations) and other validation rules.
I have a View which is meant to allow editing of the customer's address fields.
The problem I have is that I want a strongly-typed view but I can't get away with using the Customer type here. Since the view will...
My page is refreshing when I add a Comment in my example. What am I doing wrong?
I want the comments in the Details page to update without refreshing the page.
I am trying to do something very similar to how the comments are added here on StackOverflow.
My Details.aspx has a list of Issues, when clicked goes to a Details/id page which s...
I have an ASP.Net MVC Page with a very simple form on it: One Textbox and a submit button. The form uses the standard mvc BeginForm() syntax:
<% using (Html.BeginForm()) { %>
When the page is opened directly, everything works fine.
However, we have another web site (non MVC) that loads this page within an iFrame. Most browsers seem t...