In my page (which displays a list of information), I call a webapage that gets user information and then calls a webservice and a a stored proc for a database on a page (the stored proc inputs or updates a row of data in the db). WHen I click submit, the page is supposed to completely reload the first page with the new updated data and display it to the user. Well, the data does submit to the db, and service, but my page reloads with the old information for some reason, even though I make a call to the entire action that generated the first page. If I navigate back to the home page and then go to the page in question, the data does appear. Should I be waiting or something to call this action again or something?
I do in fact have
[OutputCache(CacheProfile = "ZeroCacheProfile")]
attribute peppered on my actions and in my web.config. Am I missing something? Are there any catches places where I should be carefull when doing this?
I actually recall the entire action that creates the first page.
If you're returning a view directly from the post it may be using the old data. Try redirecting to the GET action to show the results.
This seems to work right now.
Random number = number Random();
RedirectToAction("Action", "Controller", new { value1 = number.Next(0, 100)});
I will go with it for now.
Related
I have a page that generates random numbers for a user. On page load, it will generate data and I can handle this much with amp-list. What I want is to have a button where the user can generate new data. Think of it like a bingo number generator. Page loads and presents the user with a 6. They want a new number, how can this be done?
I was thinking I could force the page to reload by linking to itself. So the "new number" button would actually just be a url link to the exact same page and this will generate a new number on page load. Using a div with an ID i can provide #randomnumber in the URL and it will go straight to this position.
Im a bit worried about this though as Google might see this as me attempting to inflate viewing numbers to get more ad revenue and what not. Is there a better way to go about this?
You can use changeToLayoutContainer to refresh data in amp-list. Give it an ID and reference that in your on
Example:
<button on="list.changeToLayoutContainer()">Show Grid</button>
I have created a WebPage A which is called from many different pages. And there is a back button on Page A. So the back button should go to that previous page from where page A is called at that time.
I have already tried PageReference but it is not a successful idea for my problem because PageReferencing needs an int value and if I pass the previous page's reference via page parameter to Page A then it is not sure that last character will be an int value in previous page's reference which can be parsed into integer from string.
You can use plain JavaScript for this:
history.back();
or
history.go(-1);
i.e. Go back. Nothing Wicket specific.
I need to use Orbeon Forms to create a form to capture the price from a number of things. I create a form, connect it with database (MySQL), deploy the form, complete the form, and it saves the data correctly in database.
Then my question is: if I complete form_1 and save the data in the database, and later enter to the empty form_1:
Is it possible to load the data entered previously or from the last form completion for form_1?
Is it necessary to have button or any control to take an action?
When you load a page to fill a new form, notice how the URL ends with /new. When you are on that page, and save, notice how the URL changes to /edit/123 (where 123 is a long unique identifier). You can come back to edit the data by loading again this URL.
In practice, this is often done by going to the /summary page for the form, and clicking on the relevant form data you want to edit.
I'm looking at some code which has broken the saving of changes of a List item in SP2010. In the constructor of the Event Receiver the HttpContext is being stored as a local variable then in the ItemUpdating at the end a query parameter containing the return url is retrieved and passed the SPUtility.Redirect(...). This has the effect of canceling any changes that were made in the edit form. So following so scenarios I've found online I'm storing the HttpContext as a static class object and redirecting in the ItemUpdated event and edits are now persisted followed by a redirect to where we are expecting.
I have a concern though with storing a specific user's HttpContext as a static on a class which will potentially be hijacked if another user does the same action between the time user 1 sets the context initially and prior to the redirect. User 2 will overwrite the context and there are potential issues.
The only other option I can think of as a quick way out would be to store a static Dictionary where the key is the user id then remove the entry just prior to redirecting so as to not leave stray HttpContext instances leaking.
So looking at the accepted solution from here the first response by servy42 states The fact that it works for a few trivial test cases at first doesn't make it a viable solution. but doesn't suggest a viable solution.
There's another option best approach may be changing Save Button in ribbon such that when clicked, a ECMA script first save your Item, then redirect to other page, or open other page in dialog. suggested further down but is that the only other way to go?
I'm fairly new to SP and just trying to navigate through the wealth of wrong ways of doing things with my limited knowledge, whilst unfortunately being stuck with SP2010.
Any thoughts on how to go about this?
============
Edit: Further info as requested
So there are two sites one say called A which will have a sub site called B. A has a List and adding an item to that list triggers event receivers which creates sub site B and other related stuff. If I modify the B "item" from the SharePoint list of Bs then I don't need to redirect and returning to the list is fine. If I'm looking and a neatly rendered Gantt chart on A listing the Bs the if I edit B after clicking Save we need to come back to A. If I'm on B there's an edit button as well so I want to return to B after editing and clicking save.
So we have the source= appended when we go to the edit screen. From some reading I've done it seems SharePoint will pick that up and redirect. One of the fields on the edit page is the relative url beneath the A site and if that changes then the redirect url will no longer be valid and throw a 404 so we replace the old B sub path with the newly entered value. But we then need code to redirect to the new location.
I am not quite sure whether i understand your requirements correctly. But i will give it a try. Just a quick summary of what i understood (correct me if i am wrong...):
You have a Root Web in a site collection with a list
Each entry in that list corresponds to a subsite which will be created on List Item creation (ER) below the Root Web as a subsite
List items can be edited from both the List in the root web as well as from the subsite it maps to
On editing from the subsite you want to return to the subsite after saving
My approach would be this:
Follow the steps described in this article SP Dialog and List Forms
Open a dialog on the subsite that links to the edit form of the root web.
After saving the user finds himself already where he should be
Hope this helps... Cheers!
Edit: Just read the requirement about changing of url. Create a custom Edit Form which you enhance with some js that passes values back to the origin site -> Parameters in dialogs. You may then react accordingly in the javascript callback and redirect to the new url.
So here's an issue with APEX 4.2. I've created an application with some forms and reports.
So I have page 2 which has a Form and a Report beneath that, I made a trigger that, when data is inserted in the table cohesive with the form, automatically fills up a table which is at its turn cohesive with the report (also on page 2).
On this page there is also 4 buttons (Create, Save, Delete and Cancel) now my goal is to submit the data from the form and redirect me back to the same page with all the values in place. I've added a Branching which should fill up my primary key but according to the debugging no data is passed back at the page after the submit (it is saved in the database however) after navigating back and forth to the page the data can be viewed normally.
I'm blundering in the dark here and I can't seem to get it working as I want it to, any help with this would be very appreciated. ^^
Thanks in advance!
Greets J.I.N.
I got it working, I used a process to recreate the primary key (which was originally created from several other columns in the database) and passed that to the page item that should contain the data.