I am working on familiarizing myself with the MVC on ASP.NET. I have on my global.asax
routes.MapRoute("Dept", "Dept/Invoice/{Category}/{Name}",
new {controller = "Dept", action = "Invoice", Category = "", Name = ""});
The Controller.cs code gets the data and put it in a table which is fine. My html starts...
<%@ Page Language="C#...
Hi all
Using Ajax.ActionLink's OnSuccess-Event brings me some trouble.
As asked here the function cannot be called directly. I tried all the suggestions I found, I get a message "Object required". The javascript-function expects an event, which is nothing/null when I pass it the correct way.
Code snippets
Before:
OnSuccess = "ListA...
Right now I have a rather annoying framework that requires a set of php/asp pages and a CGI executable to run. This thing is annoying enough to set up (licensing server, persistent processes, IIS configuration hell, etc) that it isn't practical to setup a local IIS server.
I am wondering if there is an easy way to proxy all requests of...
Hi
When checking for a users role in my custom authorize tag I am going to need a 3rd value. Like the built in stuff allows for this
"filterContext.HttpContext.User.Identity.Name;"
But this won't work for me since I will have many users with the same name. So I don't think this will help me when I have 10 with the same name and I hav...
I have a dynamic table like:
<tbody>
<% foreach (var item in Model)
{
%>
<tr>
......
</tr>
<% } %>
</tbody>
Then I want to change the row background color to different for neighbor row:
<tbody>
<% int i = 0;
foreach (var item in Model)
{
%>
<%if (i++ % 2 == 0)
{ %>
...
Suppose I have ViewModel like
public class AnotherViewModel
{
public string Name { get; set; }
}
public class MyViewModel
{
public string Name { get; set; }
public AnotherViewModel Child { get; set; }
public AnotherViewModel Child2 { get; set; }
}
In the view I can render a partial with
<% Html.RenderPartial("AnotherView...
Hi
I am trying to recreate my cookie what would be normally generated by FormsAuthentication.SetAuthCookie() and what is in the webconfig.
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" protection="All" timeout="20160" name=".ASPXAUTH" path="/" requireSSL="false" slidingExpiration="false" defaultUrl="default.aspx...
Given a URL:
http://www.stackoverflow.com/question?ask=123&answers=5
and its corresponding ActionMethod and Model:
public ActionResult Question(RequestObject request)
{
return View("Question", request);
}
public class RequestObject
{
public string AskId
{
get;
set;
}
public string NumberOfAnswers
...
<% =reg.Event.Title + " - " + reg.Event.Date %>
Works.
<% =reg.Event.Title + " - " + reg.Event.Date; %>
Tosses a runtime error:
Compiler Error Message: CS1026: ) expected
There are no mismatched operators - no unclosed '(' ...could something in a controller or further upstream in the backend be to blame?
thx
...
I'm working on an MVC site with an image upload capability, and I want to write a test that will upload an image. Sounds simple.
I made an image called TestImage.jpg and set Copy to Output to be "Copy if Newer".
In my test I try to load that with the following code:
System.Drawing.Image testImage = System.Drawing.Image.FromFile(@"Tes...
I have some code like this:
<a href="<%= Html.ActionLink(
e.Member.UserName,
"profile",
"members",
new {username = e.Member.UserName}, null) %>"/>
The links it generates look like this:
http://mywebsite.com/members/profile/?username=scottm
Is it possible to make the link this:
http://mywebsite.com/members/profile/...
I have a jQuery autocomplete fild which gets existing data from my MVC action. I want to ensure that the data entered into the field DOES NOT already exist on the database.
I had thisworkig using .result and .change on the autocomplete to set the field to class = "input-validation-error". When I added xVal client validation this still w...
Does anyone know of a good/usable ASP.NET MVC code/solution generator. Ideally it would build from a domain model, but from a data model is also acceptable.
If you do, can you answer the following:
Does it produce "good" code?
Can it be extended?
What do you like and not like about it if you have used it?
What great fearures does it c...
Anyone have any idea where I can get a good collapsible (and stay open when selected) vertical menu for an asp.net mvc project?
...
I have a table that I've made sortable using the jQuery plugin Tablesorter 2.0. On the same page, I have a Google Map that displays a marker for each item in the table. Now, I want to make it so that when a <tr> is hovered, the corresponding marker on the Google Map is highlighted. I also want to do the vice versa, where clicking on a ma...
I have an ASP.NET MVC application which uses plain HTML. I quickly need to add tabs and a datagrid to it. I've been evaluating ASP.NET AJAX and jQuery, but am running out of time to make a decision.
If I needed to add these 2 features quickly, how should I proceed? ASP.NET AJAX or jQuery?
...
I have written an action filter which detects a new session and attempts to redirect the user to a page informing them that this has happened. The only problem is I can not figure out how to make it redirect to a controller/action combo in an action filter. I can instead only figure out how to redirect to a specified url. Is there a d...
Is there a list of all the ASP.Net MVC action results and their uses?
I've been busily using ActionResult for almost everything but I know that's not correct and that I should be using more specific action results.
I've Googled this but cannot find a list. We've just bought the Wrox book but it's more than a week away from delivery an...
I have built a shopping cart that uses Session State to keep the shopping cart data while the user is browsing the store.
I have an issue where if I leave the browser window open for a long time on step1 of the shopping cart, then press "go to step 2", my actions throw an error because the step2 action assumes the session hasn't expired...
I am developing a standard small ASP.Net MVC website which will be made multilingual using ASP.Net resource files.
My question is about the resource files. See if you have a block of text which should be shown in paragraphes, is it appropriate to add <p> tags inside your resource file text?
If not, what would be the best way to deal wi...