ASP.NET MVC 3 Session - asp.net-mvc

I am very new to MVC. I am coming from web forms.
I have a simple search page. The user has option of searching contacts by state. I have a multi select box where they can select multiple states and click search contacts.
The result contacts will be displayed in a grid. The grid has options of edit,details and delete.
When they click delete it goes to a different page and asks for confirmation. Once they click delete and its done succesfully i am redirecting to the search page. But i want to redirect them to the same list they have earlier.
How i can acheive this with MVC ??
I am storing the selected state ids in an integer array in the view model.

You could try doing a modal popup and then doing an Ajax request and bind the results to a Partial view on the page.
Ie. $('#partialDiv').load( your controller call here )
Might make for a better experience...

Related

Single page application vs Standard MVC more details in post

I'm using kendo for my client side framework using MVVM single page application architecture for a multi page MVC app that I'm currently working on. What happens is there are 4 pages/steps in total in which the first 3 steps requires users to enter in some information and hitting the next button and using kendos router function to route to the specific page on button "Next" press.
Each pages values depends on the previous page, so in page 1 user would enter in some user ID's, on next button click it will call an AJAX call to my controller method passing in a viewmodel from the view and then returning some values based on those ID's and load them on page 2.
Because the values are loaded based on a kendo observable viewmodel from the view on page 1, if the user was to refresh on page 2, the values would all become null since the refresh would basically wipe out all the values saved in the viewmodel or if the user presses the "Previous" button or the back button on the browser whatever values they entered on page 1 would also be empty instead of displaying the previous values they've entered.
Main question would be is this the right architecture for what I'm doing? Should I just be doing standard MVC and passing my viewmodels/populating my screens from the server side so my values would never be null but on refresh it would just always hit the server side code.
If a single page application architecture is fine for such an application what would be some solutions for this problem?
Thanks

Is this the right MVC Application Structure

Requirements:
1.A page showing list of id's from the database.
2.Once the user clicked the item ID in the list, a modal will pop up showing all details from that id
Problem:
MVC seems to required another URL in order to use the selected id that cause redirection from another page showing the id details
Solution:
so what i did is put the list into a partial view and call the partialview in another page pretending that it didn't redirects.
Question:
Am I doing it the right way or a dirty way?
Do MVC behave this way?
If you have any suggestions please let me know.
this is not the mvc issue, if you want to popup a modal window to show the detail information, there are many ways can do that, this is the javascript issue, you can use jquery dialog or sweet alert2 or others js lib for that.

sending parameters to another website

I use Asp.Net Mvc4. I need to transfer some data to another web site.I want to explain:
There is a site that people query their salaries on this site. For exmaple www.xsalary.com. People enter this site. They enter their identity number, year, month etc. infos to textboxes into this site. Then they click submit button and, the site shows their salary infos to them.
I have a personnel web application. I have personel's identity number etc. I show personnel salaries in a page. In this page, there is button.When someone click this button, application open the site that I explain above, and textboxes in this site is filled with my sending parameters identity number, year etc. infos.
I hope I can explain what I need. How can I do this in Mvc ? Is it possible ?
Thank in advance.
My idea would be. Put a #html.TextareaFor element on your main site. Connect this element with your Model. If the user push the submit button, you send the information from your textarea to your controller where you can query the Information from your database. Now you can put the salary information into another view.
Let the controller call the result view and show the user his salary information.

How to make the current child page refresh from the master page of an MVC app

I'm developing an MVC application that is essentially a "dashboard" on the home page and the rest of the application is various reports. One of the requirements is to be able to change parameters in the header that affect whatever page you are on. For example, if you are on the home page and looking at data for Group A, you can change to Group B and see the dashboard change. Similar behavior if you are on a report page - change to Group C, and the report refreshes with the appropriate data.
The listing of groups is a dynamically created menu in the master page, so each group option is a link. Normally I'd make each link an ActionLink and direct it to a specific page, but in this case I need the link to write the selection to a database and tell whatever the child page is to refresh.
What's the correct/most efficient/best way to set this up?
I'd consider doing this with a tabbed interface using jQuery UI tabs. In this case each tab corresponds to the action that generates the dashboard for a group. Switching between tabs causes the action for the tab to reload via AJAX the tab's contents. You can use the Cookie plugin to make the tab sticky between sessions -- see the docs for the tabs plugin.

Parameters through postback

I'm working with Ruby on rails 2.3.4 and I'd like to pass some parameters from one page to another ones the first one is submitted.
For example:
On the first page, I have a form that when it's filled a Preview button can be clicked to check all the info entered before submitting the form. That button redirects to another page with the info entered before, but I don't know how to get it in the second page.
There are two possible solutions:
You can emulate the stepped form filling by creating a record in first form and saving it with status "unverified" or "pending". This way you won't have to deal with hidden form fields in 2nd and 3rd pages. All you'll need to pass is the id of pending record. You'll just need to update record status to "active" once the data is confirmed.
Use client side paginated from (all popular JS frameworks have plugins for this). Hence you will only display different <div>s in single loaded page (something like an interface for a setup wizard).

Resources