asp.net-mvc

dropdownlist in asp.net mvc

i just could not figure out how i will put my data on a selectlist for it to be displayed on a dropdownlist.. i am using mysql as my database.. on my model i have this query: Imports Microsoft.VisualBasic Imports System.Data Public Class ClassCategoryConnection Inherits ClassConnection Public Function SelectCategory() As DataTabl...

SQL Server -- How to Implement Similar Content

Hello, I have a fulltext index on the title of my articles. When someone views an article i use the title as a search string to search the full text index. I can found that the longer the title gets the less results a get and most of the time I don't get any results even though there are releated content in the database. I have tried pu...

Validation with ASP.NET MVC Linq To SQL: how do I avoid editing a generated source?

I'm reading several docs on validation in ASP.NET MVC. Ignoring those that suggest to reinvent the wheel writing your own validation logic, most articles advocate the use of xVal or Data Annotation Validators, both of which allow declarative validation through decorating models' properties(*). I think I'll go for xVal, as it seems to be...

Update Ajax.RouteLink parameters with jquery

I have a table that lists users that are registered at my website. The page contains a textbox that acts like a filter: as soon as a user types something into the textbox, the table is filtered, so only users are retrieved whose name contains the value of the textbox. This is done using jquery. It posts to a controller action, which in ...

Accessing views with absolute paths on ASP.NET MVC

I'm trying to access a view in this way: return View(@"~\Items\Details.aspx"); and I get this error: The view '~\Items\Details.aspx' or its master could not be found. The following locations were searched: ~\Items\Details.aspx On the ItemsController, in the Details action, returning View() works just fine. Why can't I access t...

Prevent many different MVC URLs from filling ASP.NET Cache

Our website uses ASP.NET MVC for a part of the pages in it. These URLs typically have the form http://oursite/detail.mvc/12345/pictures/ In this URL, the 12345 is an ID in the database. We have several hundred thousands objects for which we show detail pages. Recently we noticed a rise in the memory use for the site, so I investigated a ...

ASP.NET MVC 2 parameters throws JS error

My application works fine when I have only one parameter. e.g. /Product/Index/2 /Report/Sales/08-2009 But it failes when I add one more part to the url. Let's say I want to add the end month-year parameter to the url routing. Mow it becomes: /Report/Sales/05-2009/09-2009 I do get both parameters in my action method. I parse it and...

How do I display a custom error page for an Http 401 result?

I have a controller with an Authorize attribute like this: [Authorize(Roles = "Viewer")] public class HomeController : Controller { //... } and my web.config has customErrors set like the following: <customErrors mode="On"> <error statusCode="401" redirect="notauthorized.html"/> </customErrors> When I try to invoke an ac...

Issues mocking the MVC ControllerContext request

I'm pretty new to testing and mocking and i am trying to write a test that will ensure that my validation logic is setting ModelState errors correctly. What I'm seeing is that the controller.ControllerContext.HttpContext.Request is set the first time I check it but every time after that the Request is null. This is causing a null r...

First request is very slow after website sits idle with Asp.net mvc IIS6

Hello, I have a project in asp.net mvc, my hosting is using IIS6, and the first request after the website sit's idle is very slow. I looked at, http://forums.asp.net/t/1418959.aspx and asked the hosting for this settings. They say that the actual settings are: "The pool is set with Idle Timeout disabled, Rapid-fail enabled and with a s...

Using Stored Procedures with Linq To Sql which have Additional Parameters

I have a very big problem and can't seem to find anybody else on the internet that has my problem. I sure hope StackOverflow can help me... I am writing an ASP.NET MVC application and I'm using the Repository concept with Linq To Sql as my data store. Everything is working great in regards to selecting rows from views. And trapping very...

How can I get AttributeExchange and/or SimpleRegistration working with MVC?

I'm banging my head against a wall trying to get either AttributeExchange or SimpleRegistration working with the 3.2.0.9257 version of DotNetOpenAuth. Here is what I've done: Downloaded the 3.2.0.9257 tag from GitHub Opened the DotNetOpenAuth visual studio solution Made changes to the OpenIdRelyingPartyMvc sample The changes are all...

Integrating OpenID into a website's registration process

I want to integrate the same registration process that Stack Overflow has into my website. Does anyone know if this is possible and any ways I can go about doing this? I am using ASP.NET MVC for my site implementation. It would be awesome if someone could point me in the right direction with some examples etc. ...

Post with jQuery AJAX to ASP.NET MVC 1.0

I'm doing a jQuery AJAX post like this: var form = $("#formid"); form.submit(function() { $.ajax( { type: "POST", url: form.attr("action"), // points to NewClient data: form.serialize(), success: function(msg) { alert('ok ' + msg); }, error: function(req, status, err) { alert('err=' + er...

Is it bad practice to return partial views that contain javascript?

Hi all, The replies in this post sound very convincing, however, this post is just over my head and was hoping for some help: I have code in my partial view that looks like this: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <div class="messageBox1"></div> <% Html.BeginForm("BusinessAdd", "Home", FormMethod....

How do I use a function in my ASP.NET MVC View?

I want to use a simple function like this in my ASP.NET MVC View. It takes an integer parameter and returns a string. Function FileSizeString(ByVal ByteCount As Integer) As String Select Case ByteCount Case Is < (2 ^ 10) Return ByteCount.ToString("N0") + "B" Case (2 ^ 10) To ((2 ^ 20) - 1) Re...

jqGrid: Is it possible to commit a cell change when tabbing off instead of pressing Enter?

I have a simple in-line edit in my grid, and I want to commit the change when the user tabs off the textbox. The default behavior of jqGrid forces the user to press 'Enter' to commit the change, but this is non-intuitive for our users. onSelectRow: function(id) { $(gridCoreGroups).editRow(id, true, undefined, function(res...

How to access the Entity Framework

I have mapped the database in the edmx file from the database. Now how do I use linq to make a query? here is an example of my problem var Found = from o in ?????? What suppose to go in the question marks. How do I find what suppose to go in the question marks. I have tried many tutorials but that do not tell you exactly how to use L...

What pattern could help to keep track of Session["objectName"] within a Web App ASP.NET MVC?

I want to keep track of User Sessions within my MVC webapp. I know I am doing something wrong because the flow of the programming seems kind of chaotic. Any suggestions? At this point I am trying to verify Session every time I hit a different controller. private void VerifiedUserSession() { int? userID = (int?)Session...

Why my session variables are not available at construction of a Controller?

Using ASP.NET MVC when trying to get the information stored on my Session["objectName"] from the constructor, I see that the Session has not been set yet, but once the controller has been constructed then the Session contains the right information. public class ABCController : Controller { public ABCController() { var tmp = Session["...