Click here to Skip to main content
15,894,896 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a dropdownlist in edit template of gridview...when i edit,i want to show selected value in this gridview,but by default i takes only 1st selected index...how to do this in c#?please help me out

this is my code...
C#
grdPayments.EditIndex = e.NewEditIndex;
rowIndex = e.NewEditIndex;
BindGrid();

in dropdownlist,there is two item...
1. check
2. uncheck
but in case of edit dropdown,it always show check...
but i wanna show uncheck for uncheck persons & check for check persons...how to do it?
Posted
Updated 19-Feb-14 2:13am
v3
Comments
Patrick-Et. B. 19-Feb-14 6:09am    
What you need is an OnClick-Event that fires when you edit the cell and selects the correct index and an IndexChange-Event when you change your selection to get the correct index.
Member 10276220 19-Feb-14 6:15am    
grdPayments.EditIndex = e.NewEditIndex;
rowIndex = e.NewEditIndex;
BindGrid();
this is my code...
in dropdownlist,there is two item...
1. check
2. uncheck
but in case of edit dropdown,it always show check...
but i wanna show uncheck for uncheck persons & check for check persons...how to do it?
Krunal Rohit 19-Feb-14 10:12am    
You're on right path, In EditITemTemplate you've put the dropdown.
Now, put a Label in ItemTemplate and after selecting the value from dropdown set the text of Label.

-KR

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