Send gridview data from client side to server side at once - javascript

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.

Related

Sending only checked check-boxes to server in React Native

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.

Checkbox sortiing and Pagination not working toegther in codeigniter.

we are trying to do ajax pagination and check-box sorting in our front page..
step 1: whenever click on the first checkbox it sends the ajax request and also one perameter to query from database and shows the result..
Step2: when we again checked the other checkbox , the without the page reloading the ajax request is gone and display record...
- in step1:- checkword='cardiologist' (working fine)
- in step2:- checkword='cardiologist','nephrologist' (showing duplicate values from cardiologist)
but the issue here is that pagging preserves the both perameter..
when we click on the pagging class link it sends both ajax requests one after another.. that spoils the data fetching from database...
but here we require only one perameter.. i.e second one as "checkword=cardiologist,nephrologist".
Thank all in advance for help

Strange Update Panel Issue with Devexpress Controls

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.

Click button server side using JavaScript

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.

Updating GridView without postback using javascript

I have a gridview and a dropdownlist on my page.
The gridview is binded through code behind with some columns. Among these price is also a column.
My scenario is to change the price field based on the dropdown criteria.
The price column consists of values in "lakhs", and i need to change them as crores or usd or some other format as per dropdown.
I don't want to go for postbacks. I want these to be implemented using javascript.
(These changes are for user conversion. They need not to be saved on database)
Thanks in advance
Madhu
You have two options. If you don't want to go for any response from the server (i.e. you don't want to make an AJAX call), you could populate a hidden field with a list of comma-delimited values that correspond to your dropdown values. It's an ugly approach, but it would work.
The other option is to make an AJAX call to a web method on the server (or possibly a financial service like Yahoo! Finance). When your dropdown selected value changes, that event fires a call to the server.
If you were able to indicate what platform you're using (PHP, .Net or other), someone will likely be able to provide more relevant examples and code samples.
Since the grid is rendered as an HTML Table, you can actually manipulate anything on the client.
I would pickup jQuery for the task

Categories

Resources