Solved

Client side add rows to Gridview

Posted on 2010-08-20
8
746 Views
Last Modified: 2013-11-08
Hi Experts,
I want to create a Gridview,in which I can add single/multiple rows.
I want to save these rows o database on click of a save button which is outside of gridview.
Need to add new rows with javascript,so I can add textboxes,dropdown where user can enter his detail
These rows may be multiple.
Need to save all this data on save button.
For Edit and delete,it should be normal like we use for Gridview,
whenever I have rows from database ,Edit/Delete are visible and user can persom this operation.

Please let me know if you want any other information.
Your help is really appreciated.
0
Comment
Question by:johny_bravo1
  • 4
  • 4
8 Comments
 
LVL 8

Author Comment

by:johny_bravo1
ID: 33483567
I am trying http://geekswithblogs.net/AzamSharp/archive/2008/02/06/119332.aspx
but having a problem with this,
when I click 'Add new' and enter some data in it and if again I click 'Add New',previous entries are lost.
May be anyone casn throw light on this.
0
 
LVL 16

Expert Comment

by:Kamal Khaleefa
ID: 33484679
0
 
LVL 8

Author Comment

by:johny_bravo1
ID: 33484846
Hi,
Thanks for the link, but there is no way I can add new rows at client side.
What I need, user can add multiple rows in the gridview at a time and then clicking a single save,all data will be saved.
This link has functionality to add rows
http://geekswithblogs.net/AzamSharp/archive/2008/02/06/119332.aspx

but if I click 'Add new' after entering any record,that entry is lossed.

0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 16

Expert Comment

by:Kamal Khaleefa
ID: 33490523
yes it is lost because it is not saved to the database yet

if you notice in the example he click add rows many times before he fill the details
then he fill the details and click update
0
 
LVL 8

Author Comment

by:johny_bravo1
ID: 33491611
Hmm thanks for pointing that, but can we make such functionality so that I can have those records even after hitting 'Add new'.
Or same functionality using javascript.


0
 
LVL 16

Accepted Solution

by:
Kamal Khaleefa earned 500 total points
ID: 33493276
yes
you can do the following
when you click add rows
in code behind store the current gridview with its values into a session
then add the row
and then rebind the grid with the session
and keep doing that
now when u want to save
read ur data from the session and also read the last row in the grid because it is not saved yet to the session
0
 
LVL 16

Expert Comment

by:Kamal Khaleefa
ID: 33493282
also see the following link

http://forums.asp.net/p/1299021/2539186.aspx
0
 
LVL 8

Author Closing Comment

by:johny_bravo1
ID: 33519593
Thanks
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now