hi, experts, I think this question has been asked many times but my case is quite complicated . so I decided to ask there directly.
I have a gridview that has some dropdownlist columns and have one of the dropdown list column will be hidden when one option in another dropdownlist is selected
and some columns are textbox column that allows users to input some text on it.
due to some limitation, I have to put the add row button outside the gridview
then, my problem comes, I find that what users input in the textbox columns cannot be saved when add row button is clicked, after the event of add row completed, the input text disappears.
is it a must to databind again for the gridview ? another alternative ways?
and I find that it is not allowed to get the input data from gvXXX.DataSource . how to add the new row?
delaynomore
Member
10 Points
22 Posts
add a new row to grid view from a button outside the grid view
Dec 09, 2012 10:00 AM|LINK
hi, experts, I think this question has been asked many times but my case is quite complicated . so I decided to ask there directly.
I have a gridview that has some dropdownlist columns and have one of the dropdown list column will be hidden when one option in another dropdownlist is selected
and some columns are textbox column that allows users to input some text on it.
due to some limitation, I have to put the add row button outside the gridview
then, my problem comes, I find that what users input in the textbox columns cannot be saved when add row button is clicked, after the event of add row completed, the input text disappears.
is it a must to databind again for the gridview ? another alternative ways?
and I find that it is not allowed to get the input data from gvXXX.DataSource . how to add the new row?
sarathi125
Star
13599 Points
2691 Posts
Re: add a new row to grid view from a button outside the grid view
Dec 10, 2012 04:36 AM|LINK
Hi,
Refer these may help you:
http://www.aspsnippets.com/Articles/Adding-Dynamic-Rows-in-ASP.Net-GridView-Control-with-TextBoxes.aspx[^]
http://revenmerchantservices.com/page/gridview-add-new-row.aspx[^]
Try to add a new row in your gridview's datasource and bind it to the gridview.
Remember to click Mark as Answer on the post that helps to others.
My Blog :MyAspSnippets
Frank Jiang ...
All-Star
16006 Points
1728 Posts
Microsoft
Re: add a new row to grid view from a button outside the grid view
Dec 11, 2012 09:03 AM|LINK
Rebind your GridView after adding the new row:
http://amitpatriwala.wordpress.com/2008/04/18/inserting-new-row-in-gridview-in-aspnet-20/
Feedback to us
Develop and promote your apps in Windows Store