A function returns only one view.
what if I want to return multiple views in a function?
For example, I have this code:
Function Index() As ActionResult
Dim _news As DataTable = News.newsSelect()
Dim _announcement As DataTable = Announcement.SelectAnnouncement()
Return View()
End Function
I want to return _news and _ann...
What is the best and cleanest way to implement A-B testing in asp.net mvc? That is, when we make new changes to an asp.net mvc web site, we want to test the new html/css/js with a certain subset of visitors (defined on cookie, login id, etc) and then analyze some metrics (page response time, number of pages visited, $$$ in sales, etc) a...
In one of my current applications, I need to get customer data from a remote service (CRM) via Webservice / SOAP. But I also want to cache the data in the mysql database, so that I dont need to connect to the webservice for the next time (data does not change often, remote service is slow and has bandwidth limit - so caching is OK / a mu...
I am trying to use the JQuery plugin jqGrid with an asp .net mvc app.
I am passing the grid a JSON object in the following format as in the jqGrid documentation:
{
"total":1,
"page":1,
"records":10,
"rows":
[{
"i":1,"cell":["foo","bar"]},
{"i":2,"cell":["foo1","barr"]},
{"i":3,"cell":["fo...
I have noticed during some actions in MVC, such as an Edit ActionResult, if the UpdateModel fails it places the exception in to the ModelState, if I go through the collection I can find the exception.
However there is no StackTrace information.
So I have a few questions
1, How do I catch ModelState exceptions, in a generic way (ie on...
I'm deploying an ASP.NET MVC site to a IIS6 webserver, so I'm using a default.aspx/{controller}/{action} style routing strategy.
However, for some reason it doesn't really work when using the default.aspx part. No matter the url, it always gets the default action (Index) on the default controller (Public).
I've been using the excellent...
I can not use RadMenu Control in master Page whit MVC pattern(MVC Framwork 3.5)?
How Can I do it?
...
Let's say I have a controller action that is restricted to only certain users, like this:
[Authorize(Roles="somerole")]<br />
public ActionResult TestRestricted() {
return View();
}
On a view, that is public to everyone I have a link to the action defined above:
<%= Html.ActionLink("Click here!", "TestRestricted") ...
Is there a utility function for escaping JavaScript in ASP.NET MVC views? I often need to init a little snippet of JavaScript using some values from the view; for instance I may have something like:
<script type="text/javascript">
var page = new Page({ currentUser: "<%= Model.UserName %>" });
page.init();
</script>
I would expect some...
I use ASP.NET MVC with jQuery and have a lot of Ajax requests to my controllers.
Use Partial Views (usercontrols) to build the intial view when a page is loaded. Then if I need to append/replace data based on my Ajax request I build HTML from the Json response.
This approach gives me full control, ie. I can get extra information back f...
I've got a set of DB objects sitting in an EntitySet on my main object definition. This handles additions and updates fine, but I found the removing items from the list didn't result in the database records being deleted, so I had to create a method in the data repository object to delete the records as the data object doesn't have acce...
How do I get the referrer URL in an ASP.NET MVC action? I am trying to redirect back to the page before you called an action.
...
Hi there,
I'm building an asp.net mvc app that uses the default url route
«/{controller}/{action}/{id}»
My problem is with the last item in this route, the id.
The mvc framework automatically casts whatever in put in the id to the type of the parameter declared in the action.
example:
url: /mycontroller/myaction/1
public class mycont...
As a base for discussion. Create a standard ASP.NET MVC Web project.
It will contain two menu item in the master page:
<div id="menucontainer">
<ul id="menu">
<li>
<%= Html.ActionLink("Home", "Index", "Home")%></li>
<li>
<%= Html.ActionLink("About", "About", "Home")%></li>
</ul>
</div>
How can I set the visual ...
Hi,
I have a data driven asp.net mvc app. The Url of the pages is data driven too, so they cannot be hardcoded in web.config.
We are ready to deploy the website and for initial few days we want the pages to be accessible only after logging in.
Is it possible to add authorization to the site and then take it out by changing the web.conf...
I am trying to refactor to avoid parsing the FormCollection from the view so i changed this to pass in an strongly typed object. My form elements are the same names as the properties on the LinkUpdater Object. But when i put a breakpoint on the first link in the controller all of the properties are null.
any ideas or suggestions?
Vie...
I have a user control I use multiple times on a page. It uniformly formats some object "X" and allows certain interactions. What I'd like to do is to pass a separate object to each separate instance of the user control. I'm currently rendering the controls as below, and just depending on some specific ViewData being set. I'd like to ...
I'm looking for something that can spit out statistics on Visual Studio 2008 web projects, both Forms and MVC.
Things like:
Number of pages per project
Number of user controls
Number of classes
Number of methods
Number of images/CSS
File creation dates
If the information exists already in Visual Studio, I can't find it. I've also tr...
I have seen other questions about this, but I have not seen a complete solution for this.
I am using ASP.NET MVC with the Entity Framework, and I have a SQL Server database using an image datatype.
View:
<% foreach (var v in (IEnumerable<MyNamespace.Models.MyObject>)ViewData.Model) { %>
<span>
<%= v.Name %>
</span>
...
Hello SO:
I just uploaded an MVC application to my live server. Before doing so, I created a user ('anders') after creating the necessary tables and stored procedures for authentication via the aspnet_regsql command in the VS2008 Command Prompt. I successfully tested, locally, that I need to log in before (or while) accessing this view:...