MVC :: Viewbag Is Not Being Recognized In Project?

Mar 10, 2011

I am trying to use ViewBag and in my Controller I am having the code [Code]....

View 3 Replies


Similar Messages:

MVC :: ViewBag And Routes (3 - RC2)

Dec 18, 2010

I am having an issue with MVC-3 generating outgoing routes for me. This is the address of the page I am on for both scenarios: [URL] Here are the map routes:

[Code]....

Scenario 1:
From the controller:
[Code]....
From the view:
[Code]....

The resulting link that gets created. [URL] If I change the controller code to read as follows:

[Code]....

I didn't make any changes in the view, only added those two lines to the controller and the following link is created: [URL] What am I missing here? This is consistent behavior, I was able to reproduce this in other areas of my application.

View 4 Replies

Use ViewBag As A Datasource In An MVC 3 WebGrid?

Mar 13, 2011

If so what would be the syntax. I'm not finding much documentation and what I have is not working.

Controller Class:

public ActionResult Results()
{
List<GMUOverview> _results = new List<GMUOverview>
{
new GMUOverview { GMU = "EE00101R", UnitsIncluded = "12,13,14", SuccessRate = "19%", MinReqResPoints = "3", MinReqNResPoints="5", AvailableLicenses="123", TotalApplications=221, Season="1", Year="2009" },
new GMUOverview { GMU = "EE00102R", UnitsIncluded = "12,13,64", SuccessRate = "19%", MinReqResPoints = "3", MinReqNResPoints="5", AvailableLicenses="123", TotalApplications=221, Season="1", Year="2009" },

[Code]....

View 1 Replies

Difference Between ViewData And ViewBag?

Jan 16, 2011

I saw the ViewBag in MVC3? How's that different than Viewdata in MVC2?

View 2 Replies

MVC :: Check To See If ViewBag.Data Is Empty?

Feb 28, 2011

How can i check to see if ViewBag.Data is empty?

View 7 Replies

.net - MVC 3 Layout ViewBag Data Across All Child Views?

Mar 5, 2011

We need dynamic data passed to our layout file, no matter what the child view is. For example, we display some user specific data in the header of the layout.

How can we pass this data to the layout view without each action having to supply it independently? Should we use a custom controller, or is there a better solution?

View 3 Replies

How To Check If ViewBag Has A Certain Dynamically Created Property Or Not

Feb 3, 2015

Suppsoe that a certain dynamic property of a ViewBag object is optional. How can I check whether it has been created or not?

My first reaction is to check for null value.

Code:
@if (ViewBag.OptProp != null) {...}

But then how to handle the case when the property has been actually created, but the value assigned to it is null ?

How do I check if an object has a property in JavaScript?. Except mine is about .NET .

View 2 Replies

How To Get Code Coverage Working On A VS 2010 Project/Cannot Initialize The Project 'Project Name'

May 23, 2010

When I turn on Code Coverage in my test settings, on a project that references the Unity DI container I get the following error:

Cannot initialize the ASP.NET project'{Project Name}'.

The event log specifies the following reason:

Could not load file or assembly 'Microsoft.Practices.Unity, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name signature could not be verified.

View 2 Replies

MVC :: ViewBag And The Error "... Does Not Contain A Definition For 'Contains' "?

Mar 24, 2011

I am a bit puzzled by an error. Here is the scenario: The following code works fine in a view:

[Code]....while the following generates an error:

[Code]....

The error is.'System.Collections.Generic.Dictionary<string,int>.KeyCollection' does not contain a definition for 'Contains'

What is the difference between the two pieces of code that generates this error?

View 4 Replies

.net - Changes To Xml File Not Being Recognized?

Apr 8, 2010

I read a xml file (myConfig.config) and provide it as an input to a CLR method. When I make changes to this xml file, it doesn't seem to be recognizing it. When this line throws an error, I always see the first version of the file as a part of the error message.In the config file properties, I have set Copy to Output Directory as Copy always, but it still doesn't seem to work.

View 2 Replies

HtmlHelper Not Recognized In Runtime?

Aug 24, 2010

I am developing a Web app that is based on ASP.NET 3.5, and i added some page from ASP.NET MVC, everything is ok, until i use the "HTML" helper class, then the page is not being able be render, because this is not recognized.

For Example : Html.BeginForm() => this is not recognize as a method

But if i used "System.Web.Mvc.Html.FormExtensions.BeginForm", which is a extension method itself, it work fine.

Environment : ASP.NET MVC 2 and ASP.NET 3.5

View 1 Replies

MVC :: Application Not Recognized By Web Server?

Sep 7, 2010

I uploaded my MVC2 application to my web hoster, but the web site does not run. When I request www.mysite.com, I just see the directory listing page of the root directory, and the web app does not execute. I don't see any error message, though. A normal Web Forms page works fine. Why is this?

The web server is running ASP.NET 3.5 SP1. It does not have the MVC assembly installed in GAC, so I followed these instructions to upload the MVC assembly with my page: http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx , but to no avail.

View 9 Replies

String Was Not Recognized As A Valid DateTime - How To Fix It

Apr 30, 2010

i have an error is follows..

String was not recognized as a valid DateTime.

i am using three controll for getting date..

dropdownlist1 for getting day..

dropdownlist2 for getting month..

textboxx for year..

the code is..but i cant defined solution..

DateTime dt1 = DateTime.ParseExact(fromString, "MM/dd/yyyy ", fculture, DateTimeStyles.NoCurrentDateDefault);

View 9 Replies

String Was Not Recognized As The Valid Boolean?

May 15, 2010

FeatureEvents.bit_Activate = Convert.ToBoolean(collection["bit_Activate"]);

bit_Activate is checkbox ,how would i convert it to boolean above,collection is coming from the formcollection variable

View 4 Replies

HTML Element Not Recognized In Code-Behind?

Mar 12, 2010

I just wrote this into my WebForms .aspx:

<span id="GenerateChartButton" runat="server"></span>

I went to the code-behind, and typed this:

this.GenerateChartButton

and it's not recognising that I added the span to the page. Is there something I need to do to make this happen? I have been working in MVC lately, so I haven't had to worry about the relationship between the page & code-behind in a while, but I can't remember any tricks that I had to perform to reference a HTML element in my code.

View 1 Replies

Visual Studio - ASP Controls Not Recognized

Jun 12, 2010

I just installed the release version of Visual Studio 2010, and it looks like there's something wrong with the standard ASP.NET server controls. When I create a basic server control, such as a TextBox, the editor underlines it in green and says (I also get no intellisense for ASP.NET controls): Element 'TextBox' is not a known element. This can occur if there is a compilation error in the Web site, or the Web.config file is missing. The web site builds fine, and the Web.config file is not missing:

<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="false" targetFramework="4.0" />
</system.web>
</configuration>

The controls work just fine in the code-behind, and they function correctly when I run the site. Is there some configuration problem here?

View 1 Replies

Web Forms :: Controls Not Being Recognized At Runtime?

Jan 14, 2011

I created a new page in an existing project. The existing pages are still good, but the new page is having problems at runtime. The problem is that controls are not recognized and throw a "object reference not found" error. I even tried Page.FindControl and that didn't work either. This is only happening with this page. The controls are recognized at design time, and are not recognized only at runtime.

The controls were copied from a regular Web form into a content form with a master page. They worked fine when in the regular web form. Could that be the issue?

I tried creating a new page and moving the controls over, but that didn't fix the problem. I also tried deleting the designer file and recreating it (using convert to web application) but that didn't resolve it either. I'm out of ideas here. Here is the page directive and the first control that is not recognized.

<%@ Page Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="default_grid.aspx.cs" Inherits="TestItemDevelopment.default_grid" %>
<asp:Content ID="Content4" ContentPlaceHolderID="mainContentHolder" runat="server">

View 2 Replies

IsAuthenticated Not Recognized On Rewritten Pages?

Jan 2, 2010

I'm using the UrlRewriting module on my site and I can't seem to get HttpContext.Current.Request.IsAuthenticated to return "true" on any rewritten pages.

If I go to my home page (http://localhost/default.aspx) I get "true", but if I go to something like (http://localhost/contactus) I am always getting "false".

also, for a direct example, I have an edit bar that is supposed to appear to anyone who is authenticated. The if statement fires in the Page_Load method

If HttpContext.Current.Request.IsAuthenticated Then _
Me.FindControl("EditBar").Visible = True

I have also tried putting this in the page load event

Response.Write(HttpContext.Current.Request.IsAuthenticated.ToString)

Every page that is rewritten says "False" where pages that are not rewritten say "True".

View 3 Replies

String Was Not Recognized As A Valid DateTime?

Oct 27, 2010

The error points to this line: DateTime tmpDate = Convert.ToDateTime(lblCalendarDate.Text).AddDays(-7);

I know it will be something to do with I have the date as a string in one method and the date as date in another method but I don't know how to rectify this seeing as I'm knew to ASP.Net & C#. Here is the code:

[Code]....

View 6 Replies

Web Forms :: Attribute Not Recognized 'setProcedure' ?

Aug 6, 2010

[Code]....

Attribute not recognized 'setProcedure' ?

View 2 Replies

OO Issue - Class Objects Not Recognized?

Apr 9, 2010

I have an assembly that i have built with a linq to SQL item, a web reference and a class that brings it all together.I build the project and it all seems fine but when i reference the object from another project the web reference and linq objects are available but the class isnt.

View 2 Replies

Nested Repeater Not Being Recognized In Code Behind?

Dec 17, 2010

I have a nested repeater set up but the child repeater control is not being recognised in the code behind. It's not even being added to the designer file. I've tried this on an aspx and an ascx page but both gives the same problem.

<asp:Repeater ID="RepeaterParent" runat="server">
<ItemTemplate>
<asp:Repeater ID="RepeaterChild" runat="server">
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>

with this on the page the code behind only recognises the RepeaterParent but not RepeaterChild.

View 2 Replies

VS 2010 - Theme / CSS Not Being Recognized Properly?

Jul 27, 2011

I've just started a new website, downloaded a free theme from some website and I'm trying to implement that into an ASP.NET web application.

I simply copy/pasted the CSS and I'm now bringing in parts of the webpage bit by bit, starting with the header and title, then a menu bar, a ContentContainer and finally the footer.

When in the VS designer the page looks fine. The background image for the header shows up, the menu bar has its own designated space and separate background image, and the content is separated from the rest by a wide margin.

When I run the web application however, it looks nowhere like that in my browser. The header and menu background images are gone; the margin around the content is gone, etc. It seems about half the style elements are intact while the other half is somehow missing.

Things I've done and tried:

Confirmed that the correct CSS file is used for the master pageRefreshed the page a couple times, even cleared the cache and used different browsers to make sure that it's not using an old cached version or somethingClean solution / Rebuild / Build, etc...Restart VSShout at it

This problem seems to pop up from time to time, I've never been able to figure out what causes it and it usually resolves itself... This time it seems persistent though, nothing fixes it.

What could cause this? I am hesitant to say there's errors in the CSS file for two reasons:

- I have ReSharper 6 installed which checks CSS files for errors, warnings, etc, it does not find any
- It works in the VS designer!!!

I suppose I could post the source but the CSS is quite large so that would be like searching a needle in a haystack. Also, because it works in the designer I feel there must be something else going on...

View 6 Replies

Commas Not Recognized In File Exists?

Jul 21, 2012

I have a .net aspx project done with VS 2008 using the .Net 2.xxxx framework. This ASPX application is deployed on and 4 different 2003 Server boxes. 3 are running in total beautifully. In the 4th box is my issue. I do a FILE.EXISTS conditional test looking for case file pdf's. These case numbers are structured as such 2012-C-0421,001,0008.PDF

Please note the comma's used in the path. 3 of the 4 servers in court houses recognize the path to the pdf WITH the commas in them perfectly and the FILE.EXISTS works 100%. On the fourth box (same config we THINK) the exact same FILE.EXISTS does not return a hit even though we see the document sitting in the folder via explorer. IF we remove the commas and make it 2012-C-0421001008.pdf all is fine and document is indeed discovered with the EXISTS.

WHY on this one server does the original ducument path not function. We can not ask the court houses to change the way they store their documents so I need to make this work like the other 3. Again... same version..same .net framework... same OS (2003 server)

View 4 Replies

Web Forms :: Web Controls In Code Behind File Not Recognized?

Aug 3, 2010

I downloaded iTracker to get started doing some web development with ASP.NET. I don't understand why in the code behind file, the standard web controls are not recognized.

For example:

This is the ASPX File ...............

<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/ITracker.Master" CodeBehind="Details.aspx.vb" Inherits="dfs.ITracker.Details"
title="Untitled Page" %>
<asp:Content ID="Content2" ContentPlaceHolderID="cphTitle" runat="server">
<asp:label ID="lblPageHeader" runat="server" CssClass="PageHeader"></asp:label>...

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved