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 KumarPosted Nov 19, 2014, 4:24 AM
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
Prabhakar ThipePosted Nov 19, 2014, 2:35 AM
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
Joginder BangerPosted Nov 18, 2014, 11:50 AM
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 ThipePosted Nov 18, 2014, 7:54 AM
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
Abhishek KumarPosted Nov 18, 2014, 7:46 AM
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 ThipePosted Nov 17, 2014, 11:45 AM
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 KumarPosted Nov 17, 2014, 9:52 AM
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