mvc

How do you limit the No. of chars with ASP.NET MVC

I am making a blog site, on the home page I wont to display the first 50 characters of the blog description, how do I do that with ASP.NET MVC? ...

How do you write a get method that retrives the title of an object, not its Id - w/ ASP.NET MVC

So this is the method in my repository I use to get records from my db via its Id public BlogsTable GetBlogPosts(int id) { return db.BlogsTables.SingleOrDefault(d => d.Id == id); } And this is my controller using the get method public ActionResult Details(int id) { BlogsTable blogPostDetails = re...

Flexible way to pass references in Objective-C (iPhone)?

What is a good way to get a reference to "singleton" objects in Objective-C? Note, specifically, I am not referring to the singleton pattern, I am referring to objects of which there are normally only one instance. This specifically applies to application models. For example, in a cooking app, I would like a class (RecipeModel) that can ...

data persistenc in asp.net mvc controller

Hello, i want to keep a List in the controller. and manipulate it via action the being invoked from a view page. currently i'm losing the data of the List on each request. what is the correct way to do that in ASP.NET MVC Thanks ...

submit form with a new value using javascript. (MVC)

Hi, Given a form with the following elements. <input name='button' value='Submit' type='submit'/> <input name='button' value='Cancel' type='submit'/> I want to submit the form using javascript with a completely new value. this.form['button'] = 'MYVALUE'; this.form.submit(); How do I submit the form with a completely new value for...

Communicating between view Controllers

one of my view controllers has several UISwitches, and I want another view Controller to be able to access the values of the UISwitches for If/and statements. How do I do this in Objective-c? ...

making the home page require Auth (CakePHP)

Hello, I just started to learn CakePHP and i'm trying to make the homepage (views\pages\home.ctp) only available to logged users, so if an unlogged users enter to the homepage they should be redirected to Users controller, where it prompts for user data, using Auth Component. Where I can set the "controller" for the homepage? please co...

Help with my codeigniter application!

ok, decided to use the tutorial from ibm.com for the addressbook to learn codeigniter, scrapped the first project, but after I submit the form, I get the following error:Fatal error: Class 'Mcontacts' not found in C:\xampp\htdocs\AddressBook\system\libraries\Loader.php on line 184 what am I doing wrong? please help! I really want to lear...

What is the job of controller in MVC?

I am trying to learn the MVC architecture. But I am not able to understand why you need a controller. See the below code for my model and view. model.php connects to the database and retrieves the post. view.php will just display the post. model.php <?php $db = mysql_connect("somehostname", "someuser", constant("somepassword")); ...

Design question

Hi everbody, We are building software in java, and are new to it. I confused about JPA. Normally in MVC pattern, SQL queries are hidden in model. And controller can't access the db directly. When I use JPA, should model retrieve JPA object to controller? If yes, then controller has access to db, and this is against to pattern? ...

Asp.net mvc routing : ActionLink return an url with parameters in querystring

Helo, I try to have an URL like this /Forum/Index/2 for url I have a route {controller}/{action}/{page} in my global.asax If i test the above url with the Route Debugger it corresponds to the above route ( and some other but this is the fist one in the list ) but if I create an url with the ActionLink ( like this : <%= Html.ActionLi...

Controller print_r shows different from model print_r.

This is following up question from here. But the question is different. I have the following model and print_r is the following as well. This is Model MCalendar_one/getEvents($time) function getEvents($time){ ... $query = $this->db->query("SELECT DATE_FORMAT(eventDate,'%d') AS day,eventContent,eventTitle FROM eventcal WHERE event...

CakePHP External API aggregation - A Model, Datasource & Behaviour Design Question - Best Practice

Hi, I have a project that requires me to integrate with 2 REST APIs and then aggregate the results. I am building this project in CakePHP My basic approach is: Product (model) Products (controller) API1 (datasource) API2 (datasource) Aggregation (behaviour) The basic flow is: 1. User enters a product name into a search form /products...

[CakePHP] Making a controller for home page

Hello, Can you tell me how to use a controller for home page because i'm trying to put a model's data in home.ctp (homepage view) with <?php $this->user->find() ?>but it returns Notice (8): Undefined property: View::$user [APP\views\pages\home.ctp, line 1] Thanks ...

Simple MVC Framework for ASP.net?

Hi, I need a simple MVC framework, without jQuery extensions, hibernate, loggers, etc.. Only Model-View-Controller functions. Anyone have an idea where I can find one? ...

MVC populating dropdown in Edit Action

I am confused about making DropdownList in MVC. let's start with a simple case. In Address view I have a textbox for City, and a dropdown for State. My model Address table made by Linq to SQL has the following properties: Public string City{get;set;} Public string State{get;set;} and another table with states. in my controller i ma...

Does Model-View-Controller Play Nicely with Artificial Intelligence and Behavior Trees?

I come from an MVC background (Flex and Rails) and love the ideas of code separation, reusability, encapsulation, etc. It makes it easy to build things quickly and reuse components in other projects. However, it has been very difficult to stick with the MVC principles when trying to build complex, state-driven, asynchronous, animated a...

MVC 2 EditorForModel() rendering foreign key table names

I have an interesting problem and wanted so see if anyone else has seen this. I've created a MVC 2 site using Visual studio 2010 beta 2. I'm using linq to sql data model objects with data annotations. In my data model objects I'm using [ScaffoldColumn(false)] attribute to exclude the foreign key ID's from rendering to the UI when I use...

asp.net get Strongly Typed from string

My error code: string model = "Content"; Type stype = Type.GetType("mvc.Models." + model); ViewPage<stype> vp = new ViewPage<stype>(); Of course it error when compiling, but it clearly show what i'm thinking. Can i do this? ...

ASP.NET MVC switching between secure to none secure content.

After logging to the mvc site using a secure connection (https), calling actions using https connection show up with the user logged in but calling actions using http it bahaves as if user didn't log on. Since I need to use a virtual directory for https connections(and can't use that directory for http connection) Https links start wi...