Strange Update Panel Issue with Devexpress Controls - javascript

I have some strange issue with Update Panel.
I am using Devexpress Controls, JQUERY AJAX in one of my applications. I have used Server side coding + Client side coding aproach i.e. using Jquery, JS and AJAX + Update Panel on some pages where aspxgridview is there.
I am creating a scenario via example situation according to the problem I have faced:
1) There are some ASPxcomboBoxes for e.g.County, State and City.
2) On client Selected index change of Country, I have fetched the data via AJAX and bind the states in State ASPxComboBox using JSON and same for the city combo on client index change of State.
3) On the city combo's index change, I have bound a ASPxGridView with some related data and ASPxGridView and City combo is wrapped in Update Panel as we cannot bind the ASPxGridView via AJAX so to avoid postbacks I have used update panel and its working fine.
4) If user doesn't selects any record from the Grid on submit click then its prompts the user that select any one record and I have kept the validation on server side button's click event.
Now, The problem is after submiting and validation occurs. The State's combos items are repeating for e.g. initial items were : --select--, USA and after validation occurs on submit its showing --select--, USA, --select--, USA.
I have not bind the control on page load event as its binded via client side. The property of EnableSynchronisation is True to synchronise client and server items of aspxComboBox.
When I saw using debugger when I click on submit. I have quick watched State combo on page load event and its items count is 4 as 2 are repeatative items.
The problem is on even first line of page Load event when I Add Watch to it I get the items count as 4 that means items are posted wrongly to the server.
When I remove Update panel, everything works fine.
I don't know why wrong items/ repeatative items are posted on server. Please help.

Solved the Issue.
Wrapped the Update Panel to State Combo.
Actually It was not needed as State Combo need not be refreshed via Server Operations as I have used AJAX to bind it on client.
But Wrapping the Update Panel to it did solved the issue.

Related

Changing refresh button handler of Extjs GridPanel top-bar paging tool

I am trying to change the Refresh button handler of the Extjs GridPanel top-bar paging tool.
PREFACE:
I have created two stores for a single grid panel. One remote store fetches records from the DB and then after that loads the data onto the other local store. The reason is that I want local pagination with a lot of data.
PROBLEM:
Since the local store has no proxy on clicking the reload button in the grid's top-bar paging tool nothing happens. I need to overload/change the handler of that button to call the remote store to reload.
MORE PROBLEM:
I have only the extjs grid panel object on hand. Can't change the definition/code of the Ext.create('grid-panel',{}). Only have access to the output/grid object.
the button is visible through this command but can't change any of its properties.
***.***.****.***.****.gridObject.getDockedComponent('toptoolbar').getPagingItems()[10].items
*** is the namespace of the object(cant share that)
QUESTION:
Is there any way to tackle this problem or I am doomed?

Apex - Clear form when leaving page (also on redirect)

Currently, if I populate a form and leave the page, the form entries will still be present when I return to the form. Is it possible to prevent these entries from being saved?
The items' default values are populated using PS/SQL, but the content can be adjusted.
I tried creating a dynamic action to clear the items on 'Page Unload', but this didn't do anything. Is this the correct browser event, or did I simply get the implementation wrong?
Update: To provide a bit of context...
Pages:
Home
Form
DML Form (insert) - I want any modifications to not be stored
Page 3 can be accessed via Page 1 or Page 2.
If the user accesses the form via Page 2 (a different form), they will have selected a specific value and this is used to populate default values on Page 3 (via item and PL/SQL Function Body).
If the user accesses the form via Page 1, the same PL/SQL will run - this may result in Page 3 form items being empty (NULL default values).
HOWEVER, when the user edits Page 3 items (changing from default values), these values will persist when the user next accesses the form. How can I prevent this state from being captured?
You will need to clear the cache of the page. This will clear the session state of the items on the page and thus result in items being empty once again.
You may need to add this clear on several locations. If you have used column links to access the page, buttons with redirects, branches, etc. The apex URL has a part which states which pages have to be cleared, and you can generally define this clearing of a page cache declaratively.
You can also create processes where you can define which page (or pages) has to be cleared. For example, if you always want the cache to be cleared when entering the page, no matter where you came from, you could add a process on the page doing just that.
Session state is ultimately what is causing this behavior: go to the page, change some things, page gets submitted for whatever reason and causes session state to be saved.
Usually, on DML forms generated through the wizard, the cache would only be cleared when using the "create" button coming from another location (usually the overlying report).
Here is the (apex 5.0) documentation on session state and managing it.
You can do it with something like this, but first you need to add jQuery to your page. I recommend using a content delivery network (CDN). You can edit the code to clear the value in your type of forms. I hope this could help you!
jQuery CDN example
$(document).ready(function() {
$("body")
.find("input").val("")
.end()
.find("select").val("-")
.end()
.find("textarea").val("");
};
});

Using history.js with Knockout and ajax

I have some filters on the left hand side of my page which use knockout and updates the results displayed using ajax when they are clicked. I would like to use history.js to maintain state such that if the user clicks back it will load the relevant content. This seems to work fine but knockout still has the filter checkboxes I selected ticked as I am using ko.observableArray() which gets added each time a filter is selected. How do I go about ensuring that the filter is unticked without a lot of code. I know it can be done by checking the url params and then comparing them to what is already in the array.

Send gridview data from client side to server side at once

In an ASP.NET 2.0 web application, there is a gridview containing checkbox in first column.
When checkbox is checked either Header Checkbox or Row Checkbox, OnCheckChange event triggers on server side. In this event, the specfic row data or all rows data (in case of header checkbox) is added to a data table in session for further processing. Along side this, it call a few javascript function as well to check/uncheck the checkboxes, highlight the row on client side.
In case, when user wanted to check multiple checkbox but not via header checkbox. It's behavior gets wrong. If user quickly check the checkbox, few checkboxes are checked and few remain unchecked.
What I guess is that since on each OnCheckChange event there is a request to server side and then some js methods so it takes time, but befor request completeed, user checked the next checkbox and it is not actually checked.
Is there any way, I can allow user to check how many checkboxes he/she wants to check and then send them to server for storing in data table ?
Suggestions are appreciated.
You should add loader for this kind of functionality. I hope you should be using update panel. You can add update progress control for the time request is processing on server side. It will hint the user to wait. You can also use ajax request by jquery to do similar kind of work.

Radio buttons not retaining selection when user controls are posted back

I am facing some problems when page is posted back partially. I have some radio buttons based on which I am making tr display="" and display="none" by javascript. After that I am adding rows gridview. The gridview contains empltyTemplate and footer to add new rows. But when I add row in grid view, the user control is posted back and hence all the tr becomes displa="none" which is default when page is loaded. I tried to keep gridview in update panel but it not working. Hierarchy of my controls is as below.
Level-1-Master page--->Level-2-master page--->Level 3-.aspx page--->Level 4-user control--->Level-5 -multiple accordians-->Level-6: 1 user control in each accordian..
code is too long to past here.. I tried to keep update panel inside user control(Level 6) but it was not working. After some googling I found that update pane not works if it is inside accrdian. So I tried to keep all accrdian inside update panel but in that case .aspx page is not posted back but all user controls placed inside accrodian are posted back so the selection is set as they are on default load.
I want all selection to retain when the last level user control is posted back.
The situation is quite complex to understand but this is what the things are..How to solve my problem?
Changes made to the DOM from JavaScript are not retained cross-PostBack; the server has no idea what you've done, and therefore has no way to track it.
To solve this, you either need to have your JS code update state on the server side with a Callback or Ajax call -- or perhaps have it update a hidden input field in the form that reflects the state of your tags, and have the server look there and update the rendered HTML accordingly.

Categories

Resources