The Ajax request is as follows:
<% using (Ajax.BeginForm("Update", new AjaxOptions
{
UpdateTargetId = "message",
InsertionMode = InsertionMode.Replace,
OnSuccess = "success",
OnFailure = "error"
})) { %>
In the controller action method I tried to add ModelState Error as well as throw an exception bu...
I'm having a bit of an issue setting up our test site.
In IIS 7, our app pool for the site is running in integrated mode.
In Authentication, I have Anon enabled and Forms auth enabled.
In Authorization, I have Allow All users.
All pages allow anon users, EXCEPT the default (Home/Index.aspx). That page always forwards the user to the...
what is the best way to redirect site users who do not enter the www in a domain name to actually get the www site.
IE: I goto Google.com and I am redirected to www.Google.com
...
I have a link on the page that allows the user to perform a certain action if they are logged in. If they are not logged in I want the link to direct them to the login page first. This pretty common. What's the best way to do this? Currently I'm doing this but I don't like it:
<% if(Model.IsUserAuthenticated){ %>
<%= Html.ActionLink("St...
I hope this isn't a stupid question, but after searching around for quite a while, I haven't been able to find anything quite like what I'm trying to do:
We build a series of web applications that are based on a common asp.net mvc engine. I would like to write a .net web app that would allow our project managers to automatically check o...
I am creating a .NET MVC application and I have a view in which I want to display the following:
Category
followed by a list of items for the current Category
[possibly] followed by a list of sub items for the current item
I could create a custom ViewModel class that sends 3 separate IEnumerable lists (categories, items, and sub item...
public IEnumerable<SelectListItem> GetList(int? ID)
{
return from s in db.List
orderby s.Descript
select new SelectListItem
{
Text = s.Descript,
Value = s.ID.ToString(),
Selected = (s.ID == ID)
};
}
I return the above to a vi...
I'm drawing some checkboxes in a loop and i want to set the text attribute based on the objects that I'm iteration with the loop.
I've something like this:
<asp:CheckBox ID="CheckBox1" runat="server" Text="<%= Html.Encode(item.nome) %>" Checked="true"/>
The problem is that the Html.Encode(item.nome...
I'm looking for a way to set the checked property based on an integer (not boolean in this case) inside an MVC view.
Is it possible to express this inside the view alone? (with our without an html helper is fine w/ me)
...
I ask this not to start anything negative. Rather, after looking at ASP.NET MVC it hit me (duh) that I am not using controls like on webforms but coding html markup by hand (gasp.)
Is this a move backwards? I remember coming from classic asp to asp.net and dragging and dropping controls, creating a bll, etc. now it seems I am doing al...
In the StackOverflow Podcast #54, Jeff mentions they register their URL routes in the StackOverflow codebase via an attribute above the method that handles the route. Sounds like a good concept (with the caveat that Phil Haack brought up regarding route priorities).
Could someone provide some sample to to make this happen?
Also, any "b...
I found these questions, but a couple of them were a little old:
http://stackoverflow.com/questions/191556/should-i-pursue-asp-net-webforms-or-asp-net-mvc
http://stackoverflow.com/questions/88787/do-you-think-asp-net-mvc-will-compete-with-asp-net-webforms
http://stackoverflow.com/questions/722637/asp-net-mvc-asp-net-webforms-why
I do n...
I'm trying to setup a "private beta" for a site that I'm working on. The site uses open id. I don't want anyone to even browse the pages if they aren't part of the beta. What's the best way to implement this? Any suggestions?
For example:
When the site goes live, users will go to http://www.mydomain.com which will not require them to l...
For iPhone web app development in ASP.NET, where do I begin?
I'm considering using ASP.NET MVC, but how do I get started? Are there any weird caveats I should be aware of?
Looks like these might be good resources:
Mix: Mobile Web Sites with ASP.NET
MVC and the Mobile Browser Definition
File
Rock the iPhone with ASP.NET MVC
...
I'm looking for a good example that shows how to handle (in the controller) a POST onchange (of a input["text"] for example)
Currently when I set my onchange = form[0].submit(); and I watch the action hit the controller, the HTTP verb is still GET for some odd reason. But when I view source the form on the page has the method="POST" .....
I'm using the ASP.NET MVC and the ADO.NET Entity Framework together.
I want my Views and Controllers strongly-typed.
But how am I supposed to handle entity associations?
Here's a simple example:
A Person has one Department. A Department has zero or more People.
My controller passes an instance of a Person object and a collection ...
How can I use strongly-typed Controllers with EntityObjects?
My failures...
First I tried this:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(Guid id, Department Model)
{
db.SaveChanges();
return RedirectToAction("Index");
}
This failed to actually save any changes to the database. So, I tried to attach the model t...
I'm attempting to encode the encrypted id in the Url. Like this: http://www.calemadr.com/Membership/Welcome/9xCnCLIwzxzBuPEjqJFxC6XJdAZqQsIDqNrRUJoW6229IIeeL4eXl5n1cnYapg+N
However, it either doesn't encode correctly and I get slashes '/' in the encryption or I receive and error from IIS: The request filtering module is configured to de...
I have a DropDownList populated with a SelectList generated from (an anonymous type) that has two properties "CountryId" (int) and "Description" (string). I want the selected country in the list to be the defaultCountry.
Countries = new SelectList(countries, "CountryId", "Description", defaultCountry.CountryId);
where "countries" is a...
Hello,
I am using ASP.NET MVC and want to update content on my page based on the selected value of an HtmlHelper.DropDownList. I have an Admin page on which I would like to display a list of hired employees for a given semester, without having to redirect to another controller. Perhaps a table could be generated or a ListBox filled with...