i have 2 link on page PictureList
<%= Html.ActionLink("pic", "PictureList", "Admin")%>
and
<%= Html.ActionLink("pic", "PictureList", "Admin", new { id = item.MenuId })%>
after click on second link, first link catch id parameter. how can it be solved?
...
ModelState is always returning null in my unit tests. I was hoping someone could tell me why.
Given the following controller:
public class TestController : Controller
{
public ViewResult Index()
{
return View();
}
}
My test gets null for ModelState with this test:
public void ModelState_Is_Not_Null()
{
TestCon...
I've been using T4MVC (FYI: v2.6.12) for quite some time, and I've been slowly moving over our code to this way of working (less reliance on magic strings).
But I've had to stop because, for some reason, T4MVC is unable to translate objects into urls, and only seems to be able to work on primitive types (int/string/etc).
Here is an exa...
Hi
I am trying open a new window using url.Action.
And the new Window url is out of this current project(external website).
Here are two things i need to do:
I need to open it in a new window.
It is going to http://localhost:57391/Home/http:/www.yahoo.com instead of directly to Yahoo.
Here is my code:
<tr >
<td> ...
I put together the following method, which calls my repository to get an image (returned as Linq.Binary). It then writes the byte array to the OutputStream and sets the content type:
public EmptyResult GetImage(int id)
{
Byte[] imageBytes = _repository.GetImage(id).ToArray();
Response.OutputStream.Write( imageB...
I've been looking for a way to test to see if the user has Javascript enabled or a browser that supports it in ASP.NET MVC, and if they don't then route them to a page that tells them the site requires it to work.
However I haven't been able to find a definative answer to this..any suggestions?
...
I am using Ajax within MVC to render some partial views and have come across a weird problem. Once I click a tab which submits ajax.beginform to render the tab as a partial view, the following happens:
from the ajaxOptions, the OnBegin function is called.
after this it is supposed to go to the function inside the controller which is s...
I'm trying to add a webform that allows the user to add a database entry with a specific foreign key.
I'm creating the link like this
<%= Html.ActionLink("Edit", "EditSub", new { id = id }) %>
and the resulting URL is http://localhost:3015/TumourGroup/CreateSub/2 (where 2 is the id I passed to the actionlink earlier). The question is...
Hello!
I'm using ASP.NET MVC to develop a website and I need to customize my URL to use a name that is not the name of my Controller.
I want to use this Class/Method names:
public class CompanyController:Controller {
public ActionResult About() {
return View();
}
}
But I want to use the URL http://www.mysite.com/the-c...
We're gonna build a line of business app, and do it using asp.net membership for security.
What is your recommendation on building application that should be easy to maintain and as hopefully future proof? The idea being to have a really complex and customized user experience and hopefully basing it on existing third party components to...
I would like to have 4 actions with the same name (controller methods may have a different name, but their ActionName() attribute is the same for all 4 of them:
[ActionName("Same-name")]
public ActionResult AnonAction() { ... }
[HttpPost]
[ActionName("Same-name")]
public ActionResult AnonAction(ModelData data) { ... }
[Authorize]
[Act...
Hi all,
My scenario is this: I have two listbox's, one that contains all my database items, and an empty one. The user adds the items needed from the full listbox to the empty listbox.
I'm using a form to submit all the items the user has added.
The problem is, only the selected items from the listbox are submitted. So if the user des...
I'm giving MVC another shot, and I feel like I'm learning freakin' HTML all over again.
So, stupid question: At the top of my master page, I've got a partial view (or similar - I'm using the string template view engine and so far I love it) which either displays a small login form (similar to what NewEgg has), or a message like
You are...
Hi,
Sometimes I get exception in my production environment:
Process information
Process ID: 3832
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE
Exception information
Exception type: System.Web.HttpException
Exception message: Server cannot set status after HTTP headers have been se...
I'm doing a web request that is too slow. It takes around 3.2 seconds to GetResponseStream() and .8 seconds to ReadToEnd()
If I run the same request in a web browser I get a response in less than a second... I'm wondering what I can do to speed up the request and what might cause it to be slow?
Based on other questions I saw here, I di...
I'd like to create a custom validation attribute for MVC2 for an email address that doesn't inherit from RegularExpressionAttribute but that can be used in client validation. Can anyone point me in the right direction?
I tried something as simple as this:
[AttributeUsage( AttributeTargets.Property | AttributeTargets.Field, AllowMultip...
so I have a form using typical Ajax.BeginForm inside a typical partial view (say T.ascx).
now I am adding validtion errors to Model using
catch (RulesException ex)
{
ex.AddModelStateErrors(ModelState, "Upload");
return PartialView("T.ascx");
}
this was working fine and the user control wa...
Hi
I want to inserd new record into my entity Table.
While binding the records to Dropdownlist, we add one new ListItem like "- Select One -".
If it is using ADO.NET Datasets, it is much simpler as below.
But now i am using Entity Model.
Ex using ADO.NET:
ListItemCollection var_NewLists = new ListItemCollection();
ListItem ...
is there any reason the namespace 'linq' does not appear in system.data when i am in my view in asp.net MVC?
i can access the namespace fine in my code...
EDIT:
i realise this is not good design, i'm just curious
...
Does anyone have any good tutorials on using the client-validation with MVC2 and jQuery?
...