Dynamic dropdownlist in repeater, ASP.NET -


basically, codes have here : http://ranafaisal.wordpress.com/2009/02/17/dynamically-adding-removing-textboxes-in-aspnet-repeater/

however, thing that, need dropdownlist textboxes. purpose of having dropdownlist allow users select country of origin. have option add or remove particulars have entered before.

this error message:

'ddlname' has selectedvalue invalid because not exist in list of items. parameter name: value

this dropdownlist code inside repeater in default.aspx

<asp:dropdownlist id="ddlname" runat="server" selectedvalue='<%# databinder.eval(container.dataitem, "ddl") %>'></asp:dropdownlist> 

the codes behind same link provided.

  • points note: there no database involved.

please not tell me google or because have been googling past few hours, no avail. have googled enough, , tried solutions given others before posting here. pretty @ wits end

to add-on, cannot start-up application because of dropdownlist problem.

the problem need fill dropdownlist possible options before set selected value trying inline eval. switch use ondatabinding of dropdownlist , need there.

example:

<asp:dropdownlist id="ddlname" runat="server" ondatabinding="ddlname_databinding" />  protected void ddlname_databinding(object sender, system.eventargs e) {     dropdownlist ddl = (dropdownlist)(sender);      // fill ddl here (eg. ddl.items.add("abc", xyz");     // make sure value going set selected item has been added      // set selected value since exist.     ddl.selectedvalue = eval("ddl").tostring();  } 

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -