Can someone explain FormCollection parameter in ASP.NET MVC? - asp.net-mvc-4

I have a web application and it has two controller classes. The two controllers have an action with FormCollection parameter with HTTPPost attribute decorated. If I click on Form submit button then which action will be triggered to capture the form's values within the controller.

Using the Form Collection class we can capture the form's values within the controller.There are many ways to fetch these values and Form Collection is the one of them.
http://tutorial.techaltum.com/Form-collection-in-MVC.html
http://www.c-sharpcorner.com/UploadFile/dacca2/understand-formcollection-in-mvc-controller/
Follow above link It will help you to understand more.

Related

Calling normal method in Asp.net MVC to insert record without ActionResult redirect

Here is my scenario. I have a main view with a datatable. That datatable has a child record that contains a partial view that is loaded when clicked. That partial view has its own button created to insert a record into the database using #URL.Action() that calls the current Action Result. My issue is that I don't need to reload the page or really have the page do anything. When I click the button I just want a simple method to fire (doesn't need to return any action result) so I can run my code to check for existing records in the database, if not create a new one and insert it. Everything I have tried either redirects the page, reloads it or creates an blank page return. I feel like I am missing some simple. I just want to call a typical method by clicking the button from the partial view that has the form data. Can someone tell me what I am missing or have I just been staring at it too long.

Sitefinity Feather custom action form

I've got the following problem: in Sitefinity (9.1, Feather) I need a form, which can call 3rd party API (Mandrill) once submitted.
As far as I understand, I need some kind of custom widget or something.
Any help would be very appreciated.
Thanks
I would start here. You don't necessarily have to create a separate class library for creating the custom Feather widget (you can just put it in the SitefinityWebApp web project), but you can if you like. With Feather/MVC widgets you basically get a Controller and View, with an optional Model class to play with too.
In your scenario, you'd probably have a Controller with two actions: Display the form, and handling the form submission. In your form submit action you'd then call Mandrill to submit the data (or do whatever it is you need to do). In your Controller you're in C# purely, so you can do whatever you like there.

How to load Partial Views using Radio button in mvc4 asp.net razor?

I have two registration types. One is Individual and second as Business type registration.
I have two radio buttons. I have used Html Helper for this. When I click on first radio button
the individual partial view should be loaded. How can I achieve this using ap.net mvc4 razor
Use AJAX to make a request to the controller within a radio button's change function. In the controller action with an HttpPost or HttpGet decoration, you would return a partial view. Within your ajax response you would recieve it as dataType:'html' and place the result inside of a div.
Google is your best friend when you're learning.

How to add grid to Extjs Form and submit its data?

I am designing a highly complex data entry form using extjs 4.0. I am binding a model to my form.
Inside my model I am having a property say "Products" which represent the Product model. Now I want to show these products in Grid on my form Panel. User can add remove the products from the grid and save the form.
What is the best way to achieve this ?
If I understood you correctly you have a 1 to Many association of objects where the 1 side is loaded into a form for editing and the Many need to also be show but in a grid within the form.
The way I approached a similar design is by adding a gridpanel below the form. In my case there were other components so my grid was wrapped in a tabpanel. Similar to this example see form 5.
Now, what goes in the grid? Well I added a store representing my Many objects - or Products for your example. I setup a writer proxy for that store and added a roweditor plugin to the grid. The end result was an easy way for users to manage the relationships, edit properties of both parent and children objects all from one screen. I chose to have an autosync store for the Many store, but you dont have to. You can easily add a save button to the grid, or just bind the action to the parent's Save button.
Hope this get's your creative juices flowing :)
You could overwrite setValues(), getValues() methods of your form. Just add grid binding to the base methods. Note - no need to extend the form to create your own class. You could overwrite these functions right where you declare the form.
{
xtype: 'form',
setValues: function(){}
}
Hope this helped.

pass action form object from one action to another

I have 2 action classes which share the same action form. I have defined the action form in request scope for both of them. Can you please tell me how to transfer this form object from 1st action to 2nd action.
I am avoiding sessions due to IE shares the same session across windows/tabs.
Employee Management app:
When admin edits an employee, it has 3 tabs. Personal, Education, Background.
Each tab represents a separate action class, which all share the common employeeForm action form class. So when admin is on Personal tab, it populates the employeeForm object with all the employee related data. Please tell me how to transfer this object from one tab to another, so that I dont hit the DB again.
Struts 1 or Struts 2?
If it's Struts 1.x, then you need to add <html:hidden> tags within the tab's <html:form>, for each of the properties you want to share between tabs.