when click edit button form filling database values in textbox dropdown list..
textbox values set. can't set dropdownlist values..
the code is;
sqlconnection con = new sqlconnection(system.web.configuration.webconfigurationmanager.connectionstrings["connectionstring"].connectionstring); con.open(); string str = "select * master id='" + id + "'"; sqlcommand command = new sqlcommand(str, con); sqldatareader reader = command.executereader(); while (reader.read()) { ddcustomername.datavaluefield = reader["customerid"].tostring(); txtpickuplocation.text = reader["location"].tostring(); } con.close();
use selectedvalue property while (reader.read()) { ddcustomername.selectedvalue= reader["customerid"].tostring(); txtpickuplocation.text = reader["location"].tostring(); }
Comments
Post a Comment