how to Refresh different controls on main form - c#-2.0

I have a windows form application and different number of the control on the form is WPF user control. I have put element host control on the windows form and this is loading my user control at startup.
What I want is to load and refresh different number of user control at certain time on main page. As I need fresh data to be loaded.

Related

Multiple actions on click - ordering issue

When the user clicks on a link to a subpage, I want to store data in sessionStorage from the current page before leaving to the next page. Then when this new page has loaded, I want to apply the sessionStorage data on this page.
What complicates things is that the link is part a collapsing menu system. Which means that this system needs to update (which is also done on click) before the page data is stored.
So essentially, the wanted execution order:
User clicks link
Menu system is updated
Page data is stored
Browser loads the new page
Page data from the previous page loads and applies on the new page
My issue is the order in which everything is executed. I don't understand when the user clicks on the link how to control the order of when the actions are executed.
Thankful for help

C# MVC Create Form

I am using C# MVC. I have created a forms before where all of the data needed is on one form. Once the user fills, it then goes to the controller which inserts the data into a database table.
How would I handle a situation where the fields are on 3 different pages. On the 3 page, I like to submit. How does the data presist?
Also is a session variable Ok to use for data that is shared with many pages?
You could use different views, or use one view with a tabbed UI, and use three partial views as the content for each tab as an alternative.
You can use session, but then you have to ensure they can complete the content within the 20 minute time limit; as long as a postback occurs, then that limit is reset.
If your doing a wizard style workflow you could just have a ViewModel for each page and as the user progresses through to each page store each ViewModel in a Session variable. Then upon complete you could grab all the Models out of Session then aggregate the values into your completed form state.
Another way would be, for each POST call service that persists the page data into a data store so as the user navigates through each page, the entity is populated and stored on your data base via some service.
Could just have one partial view to spit out one single ViewModel that has properties for all 3 pages, and then use jQuery wizard plugins (or maybe you're writing your own) to simple manipulate the DOM to show/hide each page as the NEXT/PREVIOUS buttons are clicked. It will all still be part of one single FORM. And then hitting submit would post back to your controller method, say with a $.ajax() POST with serialized JSON.
If you shared a view model between all 3 of the pages in the Wizard, you could deploy HiddenFor fields on the pages to retain information that is not visible on that page of the Wizard.
This would persist data fields entered on other forms throughout your wizard and does not rely on the Session to store the information.

Asp.net mvc displaying results about a selection being made

I am porting an application from wpf to asp.net mvc.
In the wpf I have a view in which the user selects from a combobox the name of a client and then in some textboxes, next to the combobox, some specific information about the client will show up (email, address, etc). In wpf I fill all this information in an observablecollection that resides in memory and when the client changes, I retrieve the other ones from the collection so it won't fo through the database.
Is there any way in asp.net mvc I can do this ? Or every time the client changes i will fetch from the database the extra information ? (will be slow)
This controls is just to select the client (and the extra information to help the user) so it should be fast.
How would you do it ?
If you don't want to make a call back to the server for every selection, then you should look at a solution whereby you pre-fetch all the data that you need and hold it in a javascript object. Then you could write a javascript method that would fire on the selection DOM event.
Sounds like what you are looking for is Session. You can pull the list from the database once, store it in session, and then reference session as needed for each client's data. This recommendation is based on presumption that the list is not being modified elsewhere, and therefore, invalidating the version of the list you have stored in Session.
Using Session in ASP.NET - http://msdn.microsoft.com/en-us/library/ms178581.aspx

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.

Passing values out of silverlight unto webpage

Is that possible to have values inside a silverlight application be passed out unto the webpage, whether calling a javascript function with the values, etc.
The functionality I'm looking for: I have a map in silverlight, I select some values, I click the html submit button that is located on the webpage. The values in silverlight and also whatever input was made on the webpage is sent to the server (ASP.NET MVC Controller).
Yes, it is possible by accessing the html elements in the page:
HtmlElement field = HtmlPage.Document.GetElementByID("hiddenFieldID");
field.SetProperty("innerHTML", "someValue");
You can call this functionality when the map control is updated inside the Silverlight control. When the submit will be called in the web page it'll have the value ready on the field.

Resources