asp.net-mvc

Assign value to column with reference, using entity framework

Hello I have a problem assigning a value to an entity that has a reference. I get the intellisense and all but I get a null-reference exception when I try to assign it to the object passed into the function that saves to database. public ActionResult BookingViewEdit([Bind(Include = "BookingViewID,Enabled,ObjectLimit,RSSenabled"...

How to access JS variable in C#

Let's say I have <div id="blah">500</div> (Context: asp.net aspx page) How do I allow a c# code access that value? <% int numberiwant = ###; // Ideally 500 %> I was thinking of something along the lines of jQuery: <script type="text/javascript"> var value = $('#blah').html(); // Then do some magic and pass to c#? </script>...

Element is not defined jQuery $(element).remove()

Hello SO: I have this javascript that adds a form field, along with a link to remove that field: var fieldCount = 0; function addField() { var name = 'file' + fieldCount; var row = 'row' + fieldCount; var str = '<p id="' + row + '"><label for="' + name + '">File to upload: <input type="file" name="' + name + '" id="' + name...

ASP.NET MVC 2 DisplayFor()

I'm looking at the new version of ASP.NET MVC (see here for more details if you haven't seen it already) and I'm having some pretty basic trouble displaying the content of an object. In my control I have an object of type "Person", which I am passing to the view in ViewData.Model. All is well so far, and I can extact the object in the ...

subsonic 3.0.0.3 multiple database connection failover

Possible Duplicate: subsonic 3.0.0.3 multiple database connection failover re-posted this is never seemed to actually go up onto the listings ????? bizzare hi there, am using MVC and Subsonic 3.0.0.3 but i cant seem to pin down a specific point for multiple database connection. normally in normal .net i would have my 2 stri...

Cookie value expiring before the cookie expires

I have an asp.net MVC app that i am working on and I wrote a custom actionfilter in order to filter out certain controller actions based on authorization levels which are set on login and stored in an encrypted cookie along side the formsauthentication cookie, both cookies are set to have the same expiration time but for some reason afte...

Is a HTML Table better than a Gridview in ASP.NET MVC?

I am looking into binding some data. What method of output would be better. I usually use Gridviews, but I am unsure if the table would be better now. ...

Is it possible to copy/clone HttpContext of a web request

What's the easiest way to clone current request's HttpContext instance? I'm developing an app in Asp.net MVC v1. I upgraded the regular PartialView capabilities to actually have sub-controllers that act very similar, but have their own context. When you use PartialViews you have to fill view data for the partial view in your main view's...

Ajax upload script for multiple files, jQuery ASP.NET MVC

Hello SO: I am working on an upload script for an ASP.NET MVC application. I have an implementation that works with one file, but I would like to expand this to handle multiple uploads. Here is the original implementation: Upload View (yes I will be moving this jQuery code to its own file): <script type="text/javascript"> var fieldCo...

Dynamic Forms, Microsoft JScript runtime error: 'b' is null or not an object

I get an error while adding a partial form to my current form (kind of parent/child). The partial form is loaded with ajax and there can be none to several partial forms/childs. I got it working that every partial form gets an ID and I can save etc, but everytime I click on the ActionLink I get: Microsoft JScript runtime error: 'b' is...

Which Version of ASP.net MVC I'm having?

Hi, This seems really silly but; How can I know which version of ASP.net MVC I've on my system. I've tried Help->About in Visual Studio (2008) but its not there. ...

combining edit and age view page into a single Action

In my controller, I check for a articleID in the querystring, if it is present, I will render the edit view page, otherwise I will render the add view page. Now in my edit page, there are times when certain classes in my ViewData might be null. Put I want to pre-populate textboxes in the edit page. How can I prepopulate text into fiel...

Why does "linq to sql classes" change the name of a table when making a class?

I go in and add a new "linq to sql classes" in Visual Studio and then go and drag a table from Database Explorer to the new DBML and the name of the new class is no longer plural. What if I still want it to be plural? If I drag a table that isn't plural I get a bunch of compile errors about how there is already a type definition for al...

how to grab dynamic html and send it out with email?

Suppose I have a dynamic html form generated by MVC view (database data with style sheet). Then I want to send the same html with email. For example, the result maybe is something like: <div id="DivForPrint"> <fieldset> <legend>Hello</legend> <table> <tbody><tr> <td> ...

Is it possible with ASP.NET MVC to render a view from a template pulled from a database?

What I'm trying to do is generate email content using different templates. I think ASP.NET MVC could be a good fit for this. My controller would get the necessary data for the email and decide which view (template) to render. (It's more that just a simple mail-merge, there would need to be conditional blocks, foreach's, etc.) I wan...

Setting the Checked property of a CheckBox in ASP.NET MVC

I'm trying to work around the lack of a CheckBoxList in ASP.NET MVC. I've gotten to the point I can render a list of Enum values just fine, but I'm stuck on how to set the checked attribute based on my Model - Which in this case is a User entity that has an IList of Role entities. The role id's correspond to the enum values. This exampl...

Authorize Attribute, filter by Roles AND just one other userID

How can I include a user regardless of his role, dependent on a matching userID, and not always same user: [Authorize(Roles="Group1") AND userID=uniqueID] ...

getJSON Callback Not Firing

I'm learning asp.net mvc by working on a test project including SubSonic and jQuery. The problem that I'm encountering is that every time I want to return something more than a simple string, like a Json object, I get stymied because callbacks don't seem to fire, or come back as failed. My method to get a list of jobs in the database: ...

How can I get ASP.NET MVC's UpdateModel to ignore primary key colum?

I have a table with a GUID primary key into which I'm trying to insert a newly-created object using an ASP.NET MVC Controller's UpdateModel method (db is a LINQ-to-SQL data context): [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(FormCollection collection) { Fields field = new Fields(); field.ID = G...

ASP.NET MVC Issue with Using Reflection Created Objects with the Default Model Binder

I am having a weird issue in ASP.NET MVC with objects not being updated with UpdateModel when passed a formCollection. UpdateModel does not appear to be working properly when the object being updated is created through reflection. Scenario: I have an application which has approximately 50 lookup tables--each of which includes exactly th...