c# 4.0 - ASP.NET DropDownBox has "Text" for both Text and Value properties -


okay, feel missing simple here. have asp.net dropdownlist control:

<asp:dropdownlist id="rightcolumndropdownlist" runat="server"></asp:dropdownlist> 

in code behind, have (simplified, still has problem):

protected override void onprerender(eventargs e) {     listitemcollection options = new listitemcollection();     options.add(new listitem("name", "value"));      this.rightcolumndropdownlist.datasource = options;     this.rightcolumndropdownlist.databind(); } 

however, resulting rendered html has options contain "name" both value , text of option element.

<option value="name">name</option> 

what missing here? tried no avail:

options.add(new listitem(){ text= "name", value = "value"}); 

options.add(new listitem { text= "name", value = "value"}); 

and try specifying datavaluefield , datatextfield properties:

leftcolumndropdownlist.datavaluefield = "value"; leftcolumndropdownlist.datatextfield = "text"; 

Comments

Popular posts from this blog

how to build hyperlink for query string in php -

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

queue - mq_receive: message too long -