Click here to Skip to main content
15,885,104 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My requirement is allow user to add row if he presses either enter or tab...
when im executing the form gridview is automatically adding next row when i enter data in first cell...
Posted
Comments
Rajesh Buddaraju 19-Jul-12 7:01am    
You can handle this using last cell leave event.
Hope the follwing link will be useful for you. It's quite similar not exactly.
http://www.codeproject.com/Questions/335938/How-to-Add-a-Row-to-GridView-Dynamically-on-Button
Member 9068558 20-Jul-12 8:20am    
GridView.Rows.Add();

1 solution

Basically, you need to catch the code that's doing that, and stop it and then you can add it when you want to. There must be some event hookup that's causing the behaviour you don't want. The grid itself cannot accept data without a row, so if that's what you mean, the only solution is to have textboxes for entry and an 'add row' button. How can they enter data unless the row exists to enter in to ? But if you mean a row in your DB, your code must be doing that, so fix it.
 
Share this answer
 

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