Click here to Skip to main content
15,909,091 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello friends,
I have added groups to an dropdown list it is working fine but when I click on edit option which is in gridview then the present value of the group must be retain in the dropdown list that is the persent value must be highlighted in dropdown list.
Thanking you in advance
Posted
Comments
Sandeep Mewara 23-Apr-12 8:15am    
And the issue is? What have you tried so far?

Are you trying to say that Drop down selected value is changed after clicking edit button in grid ?

if this is the case then you have to reassign the selected value of dropdown to present selected value after postback.

if not then please provide sample code of what are you trying to achieve..
 
Share this answer
 
Find the ListItem and highlight the BackColor or select the item
C#
protected void button1_Click(object sender, EventArgs e){    
//Find element by Text or value    
ListItem lstItem = DropDownList1.Items.FindByText(TextBox1.Text);    
if (lstItem != null)    
  {        
   lstItem.Attributes.Add("style", "background-color:Red;");        
   //You can also select the item        
   //lstItem.Selected = true;    
  }
}
 
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