Click here to Skip to main content
15,880,725 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a grid view. I also have a 'Add Row to GridView' button. Now suppose, I have selected data present in the drop down list in the first row and when I click on the 'Add Row to GridView', another row gets added to the grid but the data selected in the first row disappears.

Please help.
Posted
Comments
[no name] 27-Nov-12 9:47am    
You need to add the code to the question, use the improve question link to change your question and paste your code.
[no name] 27-Nov-12 10:04am    
Put your code here then it will very help full for us
gilvani 27-Nov-12 10:58am    
Did you mean that the selected index of dropdown not persisted?
samrat399 27-Nov-12 12:14pm    
@Gilvani - yes the selected index didn't persist

I have used two grid views here, say A and B.
I am showing the user grid view A and not grid view B.
What I am doing is whenever I add a new row, I am putting the contents of grid view A to grid view B and when the row gets added, the contents of grid view B are shown in A.

This might not be the best method of doing things but it works. Also, we are using EDMX to get data from database
 
Share this answer
 
You have to write SetPreviousData method to solve this issue, because on button click autopost back will happen so , the data which you selected before will go off.
 
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