15,897,518 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 11174491 (Top 4 by date)
Member 11174491
29-Oct-14 8:06am
View
Hi, Thank you for pointing out me the mistake.
I tried below code:
@if(Model.control_id == 1){
@Html.TextBoxFor(x=>x.profile_filed)
}
else if(Model.control_id == 2){
@Html.DropDownListFor(x=> x.profile_filed,@ViewBag.control as SelectList,"select")
}
else if (Model.control_id == 3)
{
@Html.CheckBoxFor(x => x.isselected)
@Html.DisplayFor(x => x.profile_filed)
}
Now, I am getting NullReferenceException.
Member 11174491
29-Oct-14 4:19am
View
Hi, Thank you for your response. I already tried this way, but it is throwing below error
"CS1061: 'System.Web.Mvc.HtmlHelper<mvcdemo.models.profile>' does not contain a definition for 'DropDownlistFor' and no extension method 'DropDownlistFor' accepting a first argument of type 'System.Web.Mvc.HtmlHelper<mvcdemo.models.profile>' could be found (are you missing a using directive or an assembly reference?)"
Can you please correct me in what place i am doing mistake?
I post my code here:
@model mvcdemo.Models.profile
@{
ViewBag.Title = "dynamicdisplay";
}
@if(Model.control_id == 1){
@Html.TextBoxFor(x=>x.profile_filed)
}
else if(Model.control_id == 2){
@Html.DropDownlistFor(x=> x.profile_filed,"select")
}
else if(Model.control_id == 3){
@Html.CheckBoxFor(x=> x.profile_filed)
}
Member 11174491
24-Oct-14 3:47am
View
Thank you for giving me some direction to get an idea.
Member 11174491
23-Oct-14 8:02am
View
Thanks for your response. I am completely new to mvc. Can you please provide me some example?