Im new to MVC3 so please excuse me. I have the following situation: I have a simple order form and each order can have multiple products attached to it. I want this all to be on one form, so the user will be presented with a form to fill out all their information as well as select a product from a drop down list. They can then click "Add Another" and another dropdown list will appear from which they can select another product. My question is how do I access these dynamically created dropdownlist values from the controllers action? I come from Webforms and so am still trying to wrap my head around things.
Any help much appreciated.
Thanks
here is an excellent post for making master detail in mvc.net
http://zahidadeel.blogspot.com/2011/05/master-detail-form-in-aspnet-mvc-3-i.html
also model binding to a list by phil haack is a must read
Related
I have been following this guide to successfully create a Joomla custom component: http://docs.joomla.org/J2.5:Developing_a_MVC_Component/Introduction
For simplicity's sake lets say I have two tables, one for authors and one for books.
--AUTHORS--
ID
Name
--BOOKS--
ID
Name
Author_reference
Both have two views each, one list view and one edit view. When I click on a author in the list view it takes me to the list view of the books to see what books the author has written, and only those books filtering out the others.
Here the problem start, when I click on the New button in Joomla I want to add a book to that specific author, but have no way to set that reference. So far I have set that reference with a Session variable when clicking the author but that has obvious flaws such as opening another author in a new tab changing the Session variable.
EDIT: Looks like my question was not very specified. I need a way to send a parameter/variable when clicking the "New" button in admin mode in my component.
You can see a good tutorial for this on another question that I answered: How to add a link category_id added to the admin (JToolBarHelper::addNew)? - Joomla 2.5
Basically, joomla has two functions that you can set in the controller for that view to facilitate adding items to the url even through it's redirects as part of the loading, checking out, and save process.
You can build that with the "foreign key" or "category field" functionality in the Joomla Component Creator. It will save you a lot of headake. Give it a try.
I have created a Sample Module (Admin Side) in Magento.. I managed To created a form and Then Stored the form field values in Database. Now I am trying To create a search view for that. to show me all the values which i have stored in my table. however i am not able to get it. when i press the tab I directly get the form view. I want the search view first and a button there which ll direct me to this form. I want it the same way as it is for product, category or any other module. Do anyone Know How can I do it.
It's called a grid. The process is kind of long to explain here, but if you search online there are a few tutorials that explain how to do it (here's one that I found useful: http://www.webspeaks.in/2010/08/create-admin-backend-module-in-magento.html). Keep in mind that you can also model your own code after core code. If you want to make a grid like the Category grid, then go look in the code how its made.
I am new to ASP.NET MVC and I have a question regarding viewing entity relationships.
Say I have an entity called 'Person'. This holds the usual data relating to a person (Name, Email, etc). I also have a 'Notes' entity. Under EF, a 'Person' can have many 'Notes'.
I have a Person controller where I can view and preform CRUD operations on a Person object.
I can show the notes in the view easily but what is the best way to allow a user to add/edit/delete these notes from the Person view? I am hoping to do this using AJAX and not have the user move to a completely different page to add/edit/delete a note.
Thanks in advance,
ViperMAN.
When they edit a note, popup a jQuery dialog pointing to your URL to edit or have a separate Ajax.BeginForm() on the page that the details go into. When they finish the edit call a method to refresh the notes.
So:
1. In your Notes grid (or whatever)
you have an edit link for each note called "edit"
this link looks something like the following:
This one actually uses 'notes' : )
http://www.iwantmymvc.com/dialog-form-with-jqueryui-and-mvc-3
ASP.NET MVC | Problem about showing modal dialog using jQuery dialog widget
ASP.NET MVC modal dialog/popup best practice
Also beware of this scenario for multiple links:
MVC3 - Only first row link works well with Jquery Modal Dialog
Now the urls you use to populate the dialogs would be for example
/Note/Edit/10
One thing to note - jQuery validation needs to know about these new items that are being loaded via ajax into the DOM , so in your partial view you need to tell jQuery validation to include the new items - I'll edit in a bit to add this, have to grab it from another machine.
I am writing a Grails app and I have a quick question about the best way to do something. My controller has 2 lists of data, both of which are displayed on the view in separate HTML tables. What I want to do is to have a button that will allow you to move an item from one list to the other. What is the best way to do this?
I have done some research and using some form of AJAX seems to be the general consensus on the best way to do this. Is there any other way? The heart of the problem is that I can't figure out how to update the data contained in the contoller based on the button the user presses in the view.
Thanks
I solved this by just updating the model to reflect the new lists and rerendering the page
ASP.NET MVC noob here
I was writing a quiz application where a user can select her preferences (e.g. difficulty, number of question etc.), and once she hit a submit button - she got a new page with questions.
The preferences are represented as a "Preferences" object, and the questions are IEnumerable of Question.
This all worked well.
Now I decide both parts should be in the same page - and I don't know how to accomplish that:
Should I have a new model class that is a composition of these two parts?
And also - How will I make the "questions" part appear only after the user completed filling up her preferences and clicked a button?
Should I use AJAX?
I also read a little about partial views and RenderSection.. But I really couldn't understand which approach is the most appropriate for my scenario.
So how should I draw two parts of a page, where the second is only displayed after the first is submitted?
Thanks.
How familiar are you with AJAX? If I had to guess I would think a good way to do what you want to do is to have an AJAX call which is linked to an action when the user submits their preferences. The action can then return a partial view which you can have appear on the page without a reload via AJAX.