history.go(-1) function not refreshing server side controls - javascript

I am using a dropdown, a devexpress grid view and a button on my page.
My gropdown contains the months in the format MM/YYYY, and on dropdown's selection change the data binds in the grid view.
the functionality of button is to go on previous page as same as back button of browser.
Now, my prob is that if i select any month and then select another month, the data changes.
but now when i click on back button having onclick ="history.go(-1)", changes the data on the grid view but the month in the dropdown remains the same.
For example:
Suppose, first i have month selected as 02/2010
At this time the data in grid view is for exapmle 01234
now when i select month 03/2010
the data in grid changes to 56789
now when i click on back button, then data in grid changes to 01234 but the month in dropdown remains to 03/2010.
Please help me for this..
Thanks in advance for all who will give solution for this.

Server side web page should have a page-timeout. so that browser will get contents back from the web server again instead of showing it from history. Or browser might show the page as content Expired, please refresh.

The browser is caching your page. You should add a session tracker or something to your page and LINK back, (aka not JS)

Related

Cancel the entered data in the calendar

At the moment, there is a calendar on my site where the user can select a time range and data filtering will be done. For this I use the react-advanced-datetimerange-picker library.
But there is one drawback. You cannot cancel the selected data without reloading the page.
Please tell me how to make a button (example near close button) that will allow you to reset the entered filters and get the entire list of data again.
I created a function called resetDate which when clicked return the Calendar to its initial value, please check.
https://codesandbox.io/s/proud-architecture-9v7e84

Refresh previous page dropdown selection

I'm quite new to C# and asp.net and have been struggling for a few days to sort out what seems to be something simple. I've got two pages lets call it page1.aspx and page2.aspx
page1.aspx
I've got two dropdownlists with a continue button. Once the continue button is clicked it will populate data specified in my sql statement. On the first column I've got a hyperlink 'view' and in the last column I've got checkboxes which are disabled. Once I click on the view hyperlink it takes me to page2.aspx which has a button Tick and Untick which ticks the checkbox on page1.aspx
page2.aspx
On this page I've got three buttons (back, tick, untick) the tick and untick buttons is just to tick or untick the disabled checkboxes on page1.aspx. On the back button I'm trying a response.redirect('page1.aspx'); however when I get redirected the dropdownlist is empty and it doesnt repopulate the previous selected criteria to show the newly ticked or unticked checkbox.
What I've tried
I tried a function
function fnHistory() {
window.history.go(-1);
}
on the back button of page2.aspx this does keep my dropdownlist values on page1.aspx however it doesnt display the newly ticked checkbox since the page needs to be refreshed and refreshing the page takes away the dropdown values.
I tried to do a page refresh every 5 seconds on the div where the sql data gets displayed this is however not a option as its just bad practice.
I've tried update panel on page 1 for the div where the sql data gets displayed however the trigger which should be the tick and untick button is on page2.aspx
Your help and advice will be highly appreciated.
Is there anything unique on page2 that you have to open it in another window?
What about opening the 2nd page in a modal? So you can get access to page1 directly.

How to automatically refresh an interactive grid after clicking on save button or at a fixed interval?

I have an page item and an interactive grid on an apex page . Page item is of select list type and base on the selection the data in the grid changes. I have default Add row button in the grid to add rows . I want to refresh the grid after after click on the SAVE button in the grid. If the grid automatically refresh itself after a fixed interval of let's say 2 or 5 second that is also good for me.
For the current scenario the rows are getting added but are not reflecting on page in the interactive grid after clicking on SAVE but entries can be found in the table in the database. After reloading the page the entries are reflecting in the grid.
NOTE : I am working over a database link for fetching the data.
There is a way to hook upon the built-in save action of the interactive grid.
Steps below will create a custom event, listening to the interactivegridsave event. That event is fired by APEX after the Interactive Grid has completed its own save process. Make sure the event name is spelled correctly.
Create Dynamic Action
When → Custom
Custom Event → interactivegridsave
Selection Type → Region
Region → <your region>
Refresh action (maybe turn off Fire on Initialization)
I think this will help you.
When you add rows to your Interactive Grid and hit save button, it refreshes and you can see the IG updated.
In case you need to refresh the region or the page every 5/10 seconds, please follow these steps:
Define a Static ID for the IG, for example "IG1".
In the page attributes, navigate to Execute when Page Loads and enter:
var model = apex.region("IG1").widget().interactiveGrid("getViews").grid.model;
setInterval(function(){ model.fetchRecords(model._data); }, 10000);
This is going to refresh the IG every 10 seconds. You can set it to 2 or 5 seconds.
I had something similair with filters, If I added a row that shouldnt show up due to the filter I had on it would still be there until I refreshed. Of maybe if I changed something so it should no longer show up, it saved, but still showed up.
What I did was do a page submit after saving.
I have a Dynamic Action on Click Selection type jQuery Selector and the selector being [data-action="save"]
Then the action is simply Submit page.
This way after you click save, it submits the whole page and reloads.
Hope this does what you need.

Passing data from a page to textbox inside a gridview in another page

Can anyone please help me with the following situation?
I've a default.aspx page in which I've 3 user controls.
In one of the user control (say UC1.ascx), I have a gridview which has controls like hyperlink and textboxes. On hyperlink click, I am opening another page in which I've another user control (say UC1.ascx) where some data is fetched from the database and displayed in a gridview. The user will select some of the data and on button save clicked, I am saving the data into a session variable as well as closing the page simultaneously.
My problem is on this button save clicked, I want to update whatever data the user selected to be posted back to the UC1.ascx and bound to the textbox.
I'm not sure how to go about this in javascript. Got suggestion to use ASP.NET Ajax update panel. I'm completely new to ASP.NET Ajax. So somebody please help with the Ajax approach.
The page you close will need to set a value in the original window via javascript assuming the original opened a new window/popup as listed below.
However - have you thought about any other methods, such as ajax requests/update panels on the page to show other dynamic portions of data?
See: http://www.codingforums.com/archive/index.php/t-61319.html
specifially glenngv's post:
function setColor(color){
if (opener && !opener.closed){
opener.document.theForm.theField.value = color;
opener.focus();
}
window.close();
}

navigate back to same page on select-dropdown selection without clearing down controls?

I have a text box and a drop-down selection on a page, plus a bunch of urls.
Clicking on the urls navigate back to the page with an updated url (for asp.net MVC2 functionality). This does not cause the texbox to clear down.
On my dropdown "onchanged" event I call window.location = url; (with url being the pages url with a sortOrder in the query string)... but this causes the pages text-box text to clear down.
Is there any way I can get the drop-down to postback to the page on selection changed and NOT clear down the text box?
Cheers,
James.
What do you mean with "clear down"? Does the dropdown lose it's selected item (e.g. gets reset to a default value)?

Categories

Resources