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

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -