I would like to render a list of HTML links in ASP.NET MVC. Note that the links are absolute and external to the website being designed. The following code works:
<% foreach (var item in Model) { %>
<tr>
<td>
<%= Html.Encode(item.Id) %>
</td>
<td>
<%= String.Format("<a href=\"{0}\">li...
My view page has a Model which is represented by a List of Students.
I want to pass that Model to a controller parameter:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult SendMail(List<Student> students)
{
.............
return View("Success",students)
}
I tried this with an Ajax.ActionLink:
<%= Ajax.ActionLink("Send Mail to...
Hey Guys,
I've read the related questions but I cannot find one that suits my problem(or i'm just stupid).
Basically i have a factory that renders a certain "template" and that template contains certain "entities". These entities can render themselves and have a void Render method that constructs the HTML and returns it to the template...
How to load/render a usercontrol using jquery?
I have some menus on header of the page and the usercontrols for each menu. On click of the menus i need to re-load the content with the corresponding usercontrol.
How can i achieve it using jquery which avoids page refresh?
...
Asp.Net MVC 2.0 preview builds provide helpers like
Html.EditorFor(c => c.propertyname)
If the property name is string, the above code renders a texbox.
What if I want to pass in MaxLength and Size properties to the text box or my own css class property?
Do I need to create one template for each size and length combinations in my a...
I would like to do something like the following with spark.
<viewdata model="IList[[string]]" />
<for each="var file in Model">
<use import="${file}" />
</for>
This however, does not work because Spark is not evaluating the ${file} before it tries the import. This makes sense and I suspected it would not work, but how else could I do...
As part of the ASP.NET MVC 2 Beta 2 update, JSON GET requests are disallowed by default. It appears that you need to set the JsonRequestBehavior field to JsonRequestBehavior.AllowGet before returning a JsonResult from your controller.
public JsonResult IsEmailValid(...)
{
JsonResult result = new JsonResult();
resu...
I have a base controller class that attempts to look at Request.ContentType to see if its a json request or a regular HTML request. The base controller then sets a simple enum on the base class and the appropriate controller returns the correct type. However, Request.ContentType is always an empty string. why is that?
my base control...
Hi
I'm creating a search page, the page has a form that is being submitted using Ajax, after the search is performed I want to display a grid with the results.
My question is, should I create the grid when the page loads and then fill it with the data after the search is performed, or create the grid on the server when the search is pe...
Just struggling with a simple issue with ASP.NET MVC. I have a list of views, each view associated with an Index.aspx view being associated by default with /MyView.
Yet, for some reason I have 1 view named /Mappings that does not work (404 resource is not found) whereas the explicit path /Mappings/Index works.
I have the default route...
Ok here's the story:
I manage a team of 3 developers that have been working on, and recently completed, a 1 1/2 year project for one of our largest clients. The project is a web application written in .NET 3.5 MVC 1.0 SQL 2005.
Their requirements for the program were such that we had to build 10 robust completely ajax controls; one of ...
I read a lot of good things about jqGrid on SO and would like to know if it is well suited for a project I am going to working on.
We are currently looking at either sticking with asp.net classic or moving to asp.net mvc (my preference after a year working with it).
I like that jqGrid works as a JQuery plugin or as a purchasable versio...
What is the best approach to managing NHibernate transaction using Autofac within web application?
My approach to session is
builder.Register(c => c.Resolve<ISessionFactory>().OpenSession())
.ContainerScoped();
For ITransaction, I have found an example on Google Code, but it relies on HttpContext.Current.Error when deciding wh...
I am not very sure what design pattern is the most efficent to use when working with ASP.Net MVC and the Entity Framework, so any guidance is much appreciated!
Would you store the context in the Controller-class, or is it better to create a repository?
If you would recommend the repo-design, is it required to initialize the context in ...
For class, I would like a to use PHP MVC framework very similar to ASP.NET MVC with NHibernate. I am very comfortable with ASP.NET MVC. I need to use PHP and MySQL. I would not like to be concerned with the SQL to save me time. I would like to just design my PHP model classes and controllers without all of that data-access logic behind i...
I'm using the jQuery validation plugin in a very similar manner to the Remember The Milk demo.
$("#registrationForm").validate({
rules: {
email: {
required: true,
email: true,
remote: '<%=Url.Action(...) %>'
},
},
messages: {
email: {
required: "Please enter an email address",
...
I have a a model class that needs access to my repository class (used for DB access).
I have created an interface for my repository and have successfully configured Castle Windsor to inject my the appropriate IRepository-based class into my controllers via a custom ControllerFactory.
I'm having a little more trouble figuring out how to...
I'm trying to add a WCF service to my existing ASP.NET MVC web application, but with the WCF Test Client application, I keep getting HTTP 404 for the URL to the .svc file.
When I added the new WCF service to the project, it appeared to automatically make a bunch of changes to the web.config file. I tried hacking up my routes in global.a...
I would like to inject a dependency into an ASP.NET MVC model, but I can't figure out where in the pipeline to do the injection.
It's very straightforward with a ControllerFactory, but not nearly as much when dealing with models.
...
I have a habit of hardcoding URLs into my HTML:
...<a href="www.mySite.com/login">logon to your account.</a>
During development when I want to target a specific web-app version I will global search/replace the 'www.mySite' with something like 'myDev.mySite'.
Since this practice has become habitual I can't clearly remember if there'...