Click here to Skip to main content
14,835,688 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am using C#,asp.net 2.0,server 2005 and visual studio 2005

Can anybody help with the following Gridview design .

Initially i load gridview with the database values this is working.

Now when the user clicks add new row button, I should be able to add gridview with 5 textboxes dynamically.

At each row there must be a add,delete,edit button that performs corresponding operations in the database,

I should be able to add new row when the user clicks on another button add new row(button) .

All these button click event should reflect the changes in the database .


please help me.

Thanks in Advance.
Regards,

Karan
Posted
Updated 7-Jun-11 20:28pm
v3
Comments
Sunasara Imdadhusen 8-Jun-11 2:26am
   
What is your problem? have you tried anything before?
[no name] 8-Jun-11 2:29am
   
What you have tried for this? where you are struck up?

You can keep the current grid data in a data table and bind it to the grid.
When a new row is added insert in to the data table and rebind the grid.

Hope this will give you an idea.
   
hi Karan

Follow the following steps to acheive your goal

1)keep autogenerate columns to false

2)In gridview column properties Create a Template field with Hyperlink and name it as Add rows

3)Manually Create the GridView Columns with Textboxes you require and disable it and once you click on the Addrows hyperlink activate it and change that to Submit Hyperlink and capure the data and keep one submit link alsoyou can do the above function through page events and onrowdatabound ,onrowcommand and pageindexing methods.

5)use ado.net in the respective event and submit the data and disable the manual grid view row
   
For adding new row:
You need to play with DataGrid's datasource. Just add new item in the datasource and rebind the datagrid.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900