Questions tagged [asp.net-mvc-views]

A view is a standard (X)HTML document that can contain scripts. You use scripts to add dynamic content to a view.

To make it easier to add content to a view, you can take advantage of something called an HTML Helper. An HTML Helper, typically, is a method that generates a string. You can use HTML Helpers to generate standard HTML elements such as textboxes, links, dropdown lists, and list boxes.

167 questions
0
votes
3 answers

How to get value of Checkbox using formcollection in MVC4

I have a function, that collect the value of the controls of some view(.cshtml) private string ExtractEmailId(FormCollection form) { var value = form["CkbQuestion1"]; return value; } I am receiving value of Checkbox as "true,false". I need…
0
votes
0 answers

two same views with different names in mvc

I have a view UsersWhoHaveConsumedFreeCredit and it is working fine. My question is that when i copy the same code of that view in another view named xyz it gives the error resource you are looking for is removed. I need to copy the same code to…
Abdul Raheem
  • 97
  • 1
  • 18
0
votes
1 answer

on click save data of drop down list using Java Script , Jquery or Ajax

I have a drop down list. I am trying to save data of that drop down list on click event without using a button. I have tried some code but it is not working please help. Here is the view of my drop downlist @model…
0
votes
0 answers

saving date time exception

I have a class callnote with contain entity [DataType(DataType.Date)] [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)] public DateTime CallBAckDate { get; set; } and my controller is like: [HttpPost] public…
0
votes
2 answers

Use custom attribute in a view

I'm used to create custom attributes to prevent different access level to reach some methods in a controller: [AuthorizeUser(AccessLevel = "Administrator")] public ActionResult Index() { return View("Index"); } But now I would like to use the…
Léo Davesne
  • 2,103
  • 1
  • 21
  • 24
0
votes
3 answers

Unable to access view

On debugging in my controller I get a valid model as However as execution reaches the return view(model); I get What is this error about ?
Nishant Rambhojun
  • 77
  • 1
  • 2
  • 10
0
votes
2 answers

Can I pass viewdatadictionary(mymodel) into an mvc view? How then to access it?

I feel really daft asking this, sure I'm missing something really simple, but I just can't get it to work! I've created a ViewDataDictionary like this in the controller: public ActionResult Index() { var recipient = new Recipient() { …
Martin Hansen Lennox
  • 2,837
  • 2
  • 23
  • 64
0
votes
1 answer

Loading a different view with a parameter

I am developing an MVC 4 C# application and am after an answer on how to load a different view with a parameter from a function in the same controller. Here is my code: [HttpPost] [ValidateAntiForgeryToken] public ActionResult Create(int id, Room…
0
votes
2 answers

Can I have a MVC partial/child view which is NOT rendered in a deferred manner?

From what I can tell, MVC seems to treat partial views differently than the main views. It seems as though I can access an object within the main view, but not its child views if that object is going to be disposed once the main controller action…
0
votes
3 answers

A straightforward answer to using session variables in MVC Views?

I am having difficulties utilizing session variables in MVC views. In my example below, the If condition in my view is not met when I set the IsLoggedIn session variable to true via the controller. Note: I trimmed some of the irrelevant code for…
0
votes
1 answer

MVC3: How to render index view and a partial view together on _Layout

So i got a page which have a header, a navigation menu on the left(which is a partial view), and a content on the right(which is an index view). I got a problem in reloading every page's components after navigating menu. so here's my…
Laxus
  • 43
  • 1
  • 6
0
votes
1 answer

Sorting items in a list of MVC view without involvement of controller

Based on my understanding i found that we can code from the View also. So i have a list which is populated in View using foreach loop. @foreach (var item in Model) { @Html.Raw(item.Name)
@Html.Raw(item.Price)
0
votes
2 answers

How can I loop through my table to display contents side by side in MVC Razor View?

Hi i want help in putting contents side by side. Right now i can display content separately in left side and right side. But i need to display records from database. For this i am using foreach loop. So how i need to display is 1st records on left…
Raj
  • 73
  • 5
  • 15
0
votes
1 answer

How to pass data between views?

I am working on a MVC 4 project. What I want is that when user clicks on a button or a checkbox whatever on a view A, this calls a javascript function, the function in the view A passes some data to a controller, and then the controller opens a view…
peter
  • 1,009
  • 3
  • 15
  • 23
0
votes
1 answer

Rendering subcategories on click in asp.net mvc3

I am new to mvc3, developing my first project in mvc3. I have left side bar filled with top categories. On click of top category, I want to display sub categories under clicked category. Subcategories can be at any no of level. How to go for…
Sanjivani
  • 283
  • 4
  • 11