Getting the added gridview table data on the code behind - javascript

I have a gridview on my aspx (designer) file. I have added the rows through the generated gridview table through javascript to make the web more performance friendly, and I update the whole table using a save button. But I am not able to get the added rows on my code behind. Is there anyway for the browser to communicate that(new rows) to the code behind?

not an easy way - the server (code behind) doesn't know about any rows inserted by your javascript - so when you post back to the server, the rows are gone.
one solution would be:
Put your data in a server-known input-control, like a HiddenField in a serialized form.
Post back to your server and deserialize the data
Add the desirialized data to your gridview on the server

Related

Standard way to implement data input table's frontend for Django

I need to build a website with the following types of data input table.
I want to use html, css, js and bootstrap for the frontend and Django for the backend and SQLite also as Django's default database system. Now I am confused about what is the standard way to implement this type of input table's frontend. I can generally implement a table and inside the cell(means inside <td> tag) I can put another <input> tag to take input data and send it in the database from the user). Or I can use an editable table (Actually I do not know if it is possible to use this type of editable table to send data in the database or not).
Here I need an add row button and delete row icon also like the picture to add/remove the input row if needed, and I don't know how to implement it also thus it will easily reachable from the backend.
So please suggest to me what is the best way and how I should implement this frontend thus I won't be trouble to implement this website's backend also.
You can think of saving the table cell data to the backend on blur.
For this you might need to post data without submitting the form.
You can create an invisible form and submit the edited cell data of the form on every blur with row and column value to backend. You can trigger the submission of form programmatically and doing a prevent default to avoid page redirect.
On loading of the page you can get the whole data and use the framework to create table.

Get Gridview cell data using javascript with paging

I have a gridview, in which I am able to get data as per page. But I want to get all pages data.
for(i=0; i<grdview.clientid; i++)
{
var checkboxCell = grid.rows[i].cells[8];
}
For using it. Its only get cuurent page data. How can I get all pages data.
Thanks.
As par your question we are not able to get all page data by javascript. Reason behind that javascript only reads data that present or binded at current time since no postback occur that get data and bind to page.
You only access the current page data.
For this you can get data by javascript and do paging by javacript using jquery ajax.

Sending Html table data by ajax to php page

I am using laravel framework, I have one index page in that I am retrieving dynamic table from another page by ajax(using div). Then now I am allowing user to edit table values so now I want to send modified table data to next php to process some actions on those values. So how can take those modified table values and how to send it to next php page by ajax or php script. And how can I assign those ajax values to php varriables.Here is the snapshot of table
There are 2 jQuery datatables packages for Laravel (that i know of) which handle this kind of thing for you. No need for HTML in AJAX responses. Im using the one by Chumper and it makes things a lot easier. You just need to provide the data in your controller or route, and add the helper to your view.
https://github.com/Chumper/Datatable
https://github.com/bllim/laravel4-datatables-package << (haven't worked with this one)

dynamic marking changing content JavaScript

I created a table that receives data from a SQL database to a PHP script that parse this back though my AJAX to the HTML page.
With this information I create the table.
It works and the beauty of it: every time the data changes the table changes.
BUT: it reloads the whole table with new data.
What I want is to have it only reload the part that's been updates and then "mark" it until you mouse over it.
Is there any function in JS that allows to compare 2 JSON encoded strings and then only update the part that's not similar?
I have use jQuery but haven't found anything as of yet.I apologies for not showing any code but it's protected from sharing
You have to poll AJAX request to the server after every few seconds or minutes and see if there's any update. If so, you receive that update with say the id or index number of the data which you can replace with the new one. That way you won't have to update the entire thing.

how to post html data to .aspx file and save data

i want to crete some runtime control in asp.net hence i create one html file & for that i use JAVASCript for repeat that contols.i want to save the data enter into that control.but how it post to .aspx file & how the data save into database .please help me.
You can have a asp.net submit button on the page which posts everything on the server.
To read the values from the dynamically created DOM elements you will have to use the ASP classic like code - Request.Form['field-name']

Categories