mvc

How Does MVC Handle Missing Data Requirements

I'm teaching myself MVC concepts in hopes of applying them to a non-OO/procedural development environment. I am pretty sure I understand simple View -> Request -> Controller -> Request -> Model -> Response -> Controller -> Response -> View flow. What I am struggling with is understanding more complex scenarios. For instance, let's say I...

Ruby on Rails, Array to HTML table, controller or view?

In my rails app the model is fetching some XML and returning an array. I want each array item (they are all text typed) to ultimately be a cell in an HTML table. Does the logic of turning the array elements into the HTML table belong in the controller or the view? Of course either will work, I'd like your thoughts on best practice. ...

Ruby on Rails check box not updating on form submission

I have an entries controller that allows users to add contact information the website. The user-submitted information isn't visible to users until the administrator checks a check box and submits the form. So basically my problem is that if I check the check box as an administrator while initially creating an entry (entries#new) the entr...

Radio button not being displayed

Im having the following code, however, I can see that the radio button isnt being diplayed. Only the label is being displayed. what is wrong with the code? <%Html.RadioButton("Role", Role.User, true);%><%=Role.User%> ...

DRY Validation with MVC2

Hi All, I'm trying to figure out how I can define validation rules for my domain objects in one single location within my application but have run in to a snag... Some background: My application has several parts: - Database - DAL - Business Logic Layer - SOAP API Layer - MVC website The MVC website accesses the database via the SOAP...

Save from viewController?

I have a very small bit of data that I would like to archive from my apps view. My question is, its far easier to save this data from the viewController, but should I really be pushing it back into my model and saving it there? BTW: I also need to do a quick load of this data when the app starts up. ...

ASP.NET MVC 2: AJAX update and Html.Display()

Hi, I have a simple form and within I'm using Html.DisplayFor() method to show some values. There is a submit button also within the form, which is triggering an update. The question is how to "refresh" the Display method(using AJAX). The particular action method must return a ActionResult. I see the only solution in putting the displa...

Insert record into mysql db with Entity Framework

Hi, the problem is that it will insert a new record in a mysql table, I have already done the mapping of the mysql db and I have already done tests returning data and everything works. Now I read from a file, where there are queries written, I have them run me back and the result of true or false based on the final outcome of single quer...

Array of datas returning issue, Overwriting

Hi, Please help me on this Here i want to save the converted data into new pointers. But everytime the data is overwriting with most recent data. Please check my code TCHAR nameBuffer[256]; //Globally Declared void Caller() { TCHAR* ptszSecondInFile= QStringToTCharBuffer(userName); TCHAR* ptszOutFile=QStringToTCharBuffer(Destinati...

Silverlight, Grids, MVC, HTTP Post

I'm trying to create an editable grid using Asp.Net MVC 2 and Silverlight (specifically a grid that displays info from a db and allows users to update that info). So far I've managed to put a silverlight grid on an a view, using this technique However I have no way of getting the updated data from the silver light grid. Is there anyway...

CakePHP - recursive on specific fields in model?

Hi, I'm pretty new to CakePHP but I think I'm starting to get the hang of it. I'm trying to pull related table information recursively, but I want to specify which related models to recurse on. Let me give you an example to demonstrate my goal: I have a model "Customer", which has info like Company name, website, etc. "Customer" hasM...

Can't get new controllers or views to work in ASP.Net MVC

Basically what the title says. I created a new MVC application. I'm trying to add new pages to the site, but anytime I do I get the following error: Server Error in '/' Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name c...

Asp.Net MVC best way to update cached table

There are certain tables that get called often but updated rarely. One of these tables is Departments. So to save DB trips, I think it is ok to cache this table taking into consideration that the table has very small size. However, once you cached it an issue of keeping the table data fresh occurs. So what is the best way to determine th...

Game AI: Pattern for implementing Sense-Think-Act components?

I'm developing a game. Each entity in the game is a GameObject. Each GameObject is composed of a GameObjectController, GameObjectModel, and GameObjectView. (Or inheritants thereof.) For NPCs, the GameObjectController is split into: IThinkNPC: reads current state and makes a decision about what to do IActNPC: updates state based on wha...

MVC and Pagination

As an MVC newb, I keep getting caught up in the details. One in particular is making me pause longer than I'd expect; pagination. Should pagination go in the model, or in the controller? In case it matters, I'm using ZF, and would like to paginate the results of some SQL data. ...

General rule - when to use a model (Codeigniter)

Hi guys, I was just curious as to what the rule of thumb was for models. Generally, I use them only for situations where I need to add/edit or update database entries for an object. However, I'm building an app at the moment that has a "config" table which holds various data, such as last updated, which will control when certain featu...

How to pass javascript function as a parameter in the route values of Ajax Actionlink

Hello experts, I need to pass javascript function as a parameter value to the ajax actionlink in asp.net mvc app. how can we achieve this? Thanks in advance. ...

Asp.Net MVC - Area Route - UrlHelperExtensions

I still Create Extension methods of UrlHelper to generate your url from Route as per the Best Practices post by Kazi Manhur. I'm curious to know if a better way emerged with MVC 2 and Areas (which I now use)? So basically in your Html call a url helper extension which return a string anyhow that match an existing route. Something does...

Is it possible to maintain the url while redirecting to a classic asp page from a controller?

While migrating a site from a classic asp to MVC, I'm having the problem that not all controllers are implemented yet. For those which are not implemented, I'd like to serve the classic asp page (say /product.asp?id=123) while maintaining the nice url /product/123. To accomplish this I implemented a dummy ProductController which returns ...

How does Asp.Net MVC compare to Java MVC frameworks

I've started my career as a Java developer, then moved to Asp.NET and recently to the Asp.Net MVC, which I like a lot. When developing in Java I used Struts1, which I remember as a hideous framework with loads of XML. Now I suspect that Java MVC frameworks have moved on from the Struts times. So how do modern Java MVC frameworks compare ...