I have multiple checkboxes e.g. 50 in my SPA that I show on one of the views. The user can select/unselect any number of checkboxes and then click on save.
Send http request on every change on checkbox
Send all the data bound to checkboxes on save regardless of whether user changed something or not
Send only the changed data bound to checkboxes (dirty checking? diffing on save?)
Related
I am having trouble with one thing in my app. After my teacher logs in, he should be able to offer some reservation times for offering classes. After he clicks on the date under date-picker is rendered my custom time component with a checkbox. Then he should decide if he wants to have the class in that particular time and if not he will uncheck this box and save it(send new information to the server, with updated time that he is able to have classes). But I don't really know how to find out which checkboxes are really checked and how can I send the only array with checked times. Added pictures will describe it better. In the picture, I want only send those checked times to the server.
I suggest you to store the checkboxes inside an other div element.
Programatically you could get that div element, and can get trough its childs.
For every child check if it is checked, if checked send it to the server, if not checked do not send it. If you want to send it to the server only once, store the data in an array, then send the array to the server.
I have a page of items which are loaded by angularjs with $http.get.
On that same page, there are checkboxes of categories. For example, if user presses the checkbox men, angular fetches the items belonging to the men category without reloading the page.
Also, a user can click on some item and he will get to the detail page for that item.
The problem is that, when a user checks a category checkbox, chooses some item, gets to the detail page and presses the back button in the browser, all checkboxes are unchecked and he will see all the items, not the ones he filtered out a while ago.
How can I 'remember' what checkboxes he checked?
I assume that you currently store the category checkbox state in your controller, which is why when the user goes to the item details and then returns to the list of items the state is lost, since the controller is reloaded. In order to "remember" which checkboxes where checked you will need to create a service in which you will store the state of your checkboxes. Every time the user visits the item list page the controller will read the last state from the service and initialise the checkboxes accordingly. If the user then selects / deselects one or more checkboxes the controller will update the service in order for the new state to be stored.
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.
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.
I have a JavaScript timer, on time out I am given an alert, after which I have to call a method.
For that I have taken a temporary button and onClick I call the method like this:
__doPostBack('btn','Click');
But it is going to page load, and not the click event of the button. What is the solution to this?
PostBack is the name given to the process of submitting an ASP.NET page to the server for processing .
Examples -- 1) a login page. After the user has typed in his credentials, he clicks on the ‘Login’ button. OnClick, the page is sent to the server to check against the DB/XML file to check if the user with supplied details is an authenticated user or not.
2) There also arise certain situations wherein, you would want to do a PostBack, say you have 2 combo-boxes, Country and State, based on the value selected in the Country combo-box, the values in the state combo-box will be populated. So in this case, once the value from the Country combo-box is selected, data is "Posted-Back" to the server to retrieve the values to be populated in the State Combo-box.
Also, every time a PostBack is done, the Page-Life cycle is executed once the request comes back to the client. Hence in your case, once you do the postBack, the PageLoad() is called.