c# - DropDownList getting a blank selection -


i have dropdownlist populated code, directly database. there's selectable item no value, @ bottom. how can bind data database purely / entirely avoid getting blank selection in future?

   protected void dropdownlist_ondatabound(object sender, system.web.ui.webcontrols.gridviewroweventargs e)     {          if (e.row.rowtype == datacontrolrowtype.footer)         {             dropdownlist ddlname = (dropdownlist)e.row.findcontrol("ddlname");              ddlname.datasource = myclass.namelist();             ddlname.datatextfield = "name";             ddlname.datavaluefield = "id";             ddlname.databind();          }     } 

try remove code declaration '< asp:dropdownlist >' , type again. refresh dropdownlist scratch, clearing reference upon deleting it. current dropdownlist may taking reference somewhere along development of project.


Comments

Popular posts from this blog

css - I want to align grid in center -

Contact Form PHP Email Script -

python - SWIG function not printing output -