This is a migrated thread and some comments may be shown as answers.

[Solved] MVC Dropdown help **URGENT**

0 Answers 30 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Syed
Top achievements
Rank 1
Syed asked on 07 Oct 2011, 06:35 PM

I am using ASP.Net MVC3 using CSharp.  Table names are SMS_User and SMS_Division in SQL Server 2008.
-When i create new user i want to show division id from sms_division table. 

Table information:
SMS_User = UserName, DivisionID, EmailAddress
SMS_Division = DivisionID, DivisionName 

Below is code for SMS_User Create View()

@Html.DropDownListFor(model => sms_user.divisionid, (IEnumerable<SelectListItem>) ViewData["ZamZam"], "<--Select a divison-->")


User Controller:
Controller Code:

private NetPerfMonEntities2 db = new NetPerfMonEntities2();   
IEnumerable<SelectListItem>ZamZam= db.SMS_Division.Select(c => new SelectListItem   
{ Value = c.divisionid.ToString(), Text = c.divisionid.ToString() } );


Error Message:

CS0103: The name 'sms_amountlimit2' does not exist in the current context

Please advise. What I am doing wrong.  This is a very urgent request.Thanks for the help.

Tags
ComboBox
Asked by
Syed
Top achievements
Rank 1
Share this question
or