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.
Related
In the JavaScript page I have three checkboxes - 1, 2 and 3 of which the 1st box is always checked (I used checked="checked") on page load. If the user uncheck the 1st box, check 2nd and 3rd box and save. Now on page load the 2nd and 3rd box should only be checked. How can I achieve this? I am new to JavaScript. Thanks
What happens on save? When a page load happens you need to fetch the "saved" values from somewhere and check the boxes in javascript page load event. I think you could use just the browsers sessionstorage for this since it's just temporary form data - I assume:
https://www.w3schools.com/html/html5_webstorage.asp.
https://www.w3schools.com/jsref/prop_checkbox_checked.asp
So on pageload check if there are any "form data" in storage and check the boxes that were saved in memory.
I've got a tabs container with three tabs. They have select lists and checkboxes on them which have sql queries as source. Users can select entries in the lists or edit the checked boxes and save this to the database by clicking a button. This button also re-fills the select lists and checkboxes with the current data from the database after saving it.
My problem is: When a user selects an entry in a select list or edits a check box and navigates to antoher tab without clicking on the "save" button, the data stays there when navigating back to the tab. I want to assure that what is depicted in the lists and check boxes is always the current data like it is in the tables in the database.
Therefore, I tried to put an onclick event on the tabs of the tabscontainer like this one:
I didn't get it to work, becuase these elements do not have an ID and I can not set an ID for them in APEX (at least I guess so). Is there a way to do this in APEX anyway?
This is one of the tab elements:
You can put a static ID to your tab region (for example #SOME_STATIC_ID) and then select the elements with a jQuery selector:
$("#SOME_STATIC_ID a.t-Tabs-link")
You could also define an on click listener on text of the tab:
$(".t-Tabs-label:contains('Tab 1')").click(function(){alert('Doing something on click of Tab 1 !!!')});
It might not be the cleanest solution but it works.
Just in case anyone else is experiencing the same problem: I solved it by putting an custom dynamic action on the tabs container:
This fires whenever the user switches between the tabs and ehrefore worked for me :-)
For more information check this article: https://medium.com/#pierre.yotti/tabs-region-javascript-api-in-oracle-apex-37e20bc9f68f
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.
How it supposed to work: User starts typing in a textbox. If the textbox is populated with something, i show a div with 3 radiobuttons. If the user clicks one of the radiobuttons a postback on the server is made and we retrive some data. If the user clears the textbox we should uncheck the radiobuttons and hide their container. In the next step the user writes another value in the textbox and the radiobuttons appears on the screen, with neither of them selected.
Unfortunately, if the user selects the previously selected radio, the postback (selectionchangedhandler) on the server is not fired, presumably because i didn't unchecked correctly the radio button.
Do you have any ideas hot to make this work? I can't modify the c# source code because the website is generated from a CMS
tl;dr how to notify that we have no more a selectedIndex in a radioButtonGroup in c# from 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)