Hi sir
I have one gridview in aspnet and when I click on button then it create new row in gridview but suppose if the previous rows of gridview is empty then didn't allow to create new row in gridview and display a user message please suggest me as soon as possible please

Abhishek KumarRank #510 · 4.8K reputationPosted Nov 17, 2014, 4:52 AM EST
Please follow the below article.
http://www.aspsnippets.com/Articles/Add-new-Row-to-GridView-on-Button-Click-in-ASPNet.aspx
Please share your code if possible?
Abhishek
Prabhakar Thipe9 reputationPosted Nov 17, 2014, 6:45 AM EST
Hi sir,
Thank you very much
But sir when I clicked on AddNewRow button then it create new row but if my previous
row is blank then it throw an error so please suggest me how to resolve my problem
if my previous row is blank then automatically give one message means it didn't allow to
create new row and if there is value on my previous row then it allow to create a new row
please suggest me sir as early as possible Thank you very much
Abhishek KumarRank #510 · 4.8K reputationPosted Nov 18, 2014, 2:46 AM EST
Have you tried the code using the below link.?
it is working fine i have checked with sample app.
if you can share your code , I will take a look and advise some solution for this.
Abhishek
Prabhakar Thipe9 reputationPosted Nov 18, 2014, 2:54 AM EST
Hi sir,
yes sir I am using same link here also but if my grid view row is empty and when I click
on AddNewRow Button then it throw an error because my previous row is blank
if I will enter some values in the gridview row then click on AddNewRow button then it
will create a new row so my problem is when my previous gridview row is blank then it didn't allow to create a new row to user and display error message "Please Fill the record"
and I want to implement this in my projectso please suggest me how is it possible sir
thank you sir
Joginder BangerRank #360 · 7K reputationPosted Nov 18, 2014, 6:50 AM EST
i am not 100 % sure but i think you need first count the datagrid rows. suppose your gridview row count is 10. you need make a loop like that
for(int i=gridview.rows.count();i>0;i--)
{
int i=gridview.rows[i];
if(i==0)
{
//enter you code for new row
}
}
Prabhakar Thipe9 reputationPosted Nov 18, 2014, 9:35 PM EST
Hi sir,
Again one problem is there when I click on AddNewRow Button and enter some values on new row then automatically it clear the previous row record please suggest me
Abhishek sir
Abhishek KumarRank #510 · 4.8K reputationPosted Nov 18, 2014, 11:24 PM EST
I have created a sample application for you.
Please run the application and test your requirement and let me know what else you want to achieve from it.
Abhishek