Aalhussein

Aalhussein

  • 1.6k
  • 133
  • 10.1k

Server control - drop down list :using the right property?

Apr 7 2020 2:47 AM

Greetings,

 
I created a couple of dropdown list. then called a method to retrun a datareader that contains data from the database. I need to populate a form . So my code below suppose to do so, but when using selectedIndex, it works, but when using .SelectedItem.Value does not work.
Any idea why?
 


 
 
Note when populateing inputform from gv via link. Only use selected index to work. Selecting the other will not give the value to the input form. ? 
 
2nd Question, how do I know when to use any of the properties below.  Can I stick to only one for instance
.SelectedValue and ignore the rest. 
ddlqualification.SelectedItem.Value = dr["qualificationid"].ToString() ;
ddlqualification.SelectedIndex = dr["qualificationid"].ToString() ;
ddlqualification.SelectedValue= dr["qualificationid"].ToString() ; 
 
Please advise,
Thanks
Al 
 

Answers (2)