Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 27-Nov-12 3:31am
Comments
Mathlab at 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.
Lakhan Aanjana at 27-Nov-12 10:04am
   
Put your code here then it will very help full for us
gilvani at 27-Nov-12 10:58am
   
Did you mean that the selected index of dropdown not persisted?
samrat399 at 27-Nov-12 12:14pm
   
@Gilvani - yes the selected index didn't persist
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 6,631
1 Sergey Alexandrovich Kryukov 6,345
2 CPallini 5,230
3 George Jonsson 3,574
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web04 | 2.8.140921.1 | Last Updated 28 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100