Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ddlCountry is already bind. now on gridview selectedIndex changed event i want to set the Value of dropdown. how can i do this??

ddlCountry.(which property need here??) = gvCountry.SelectRow.Cells[1].text;

C#
ddlCountry.DataValueField= "CountryId"
ddlCountry.DataTextFiled= "CountryName";
ddlCountry.DataSource= objCountry.Select();
ddlCountry.DataBind();
Posted
Updated 4-Mar-14 3:04am
v2
Comments
Siva Hyderabad 4-Mar-14 8:57am    
try
ddlCountry.SelectedItem.Text
Ramug10 4-Mar-14 9:01am    
show me your ddlCountry binding code
Muhamad Faizan Khan 4-Mar-14 9:04am    
@ Ramug update question
@Siva your code make duplication in dropdownlist
Ramug10 4-Mar-14 9:10am    
Try this
ddlCountry.SelectedValue = gvCountry.SelectRow.Cells[1].text;
Muhamad Faizan Khan 4-Mar-14 9:18am    
not working

1 solution

C#
ddlCountry.SelectedItem.Text = gvCountry.SelectRow.Cells[1].text;

OR

ddlCountry.SelectedItem.Value = gvCountry.SelectRow.Cells[1].text;
 
Share this answer
 
v2
Comments
Muhamad Faizan Khan 4-Mar-14 8:55am    
selected item i have done it is making duplicate
Muhamad Faizan Khan 4-Mar-14 8:56am    
making duplicate this ddl property

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