asp.net - asp dropdownlist via databinding to vb.net arraylist -
hi need assistance understanding how databind arraylist generated vb.net function. seem experience 2 errors depending on position of array list() (inside or outside function). looking advice on how resolve issue, populate dropdownlist values function. thanks
<%@ page language="vb" autoeventwireup="false" codefile="default.aspx.vb" inherits="_default" %> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="head1" runat="server"> <title></title> </head> <body> <br /> <asp:dropdownlist id="dd1" runat="server" autopostback="true"></asp:dropdownlist> <br /> </body> </html> imports scheme imports system.directoryservices imports system.directoryservices.activedirectory partial class _default inherits system.web.ui.page public function enumeratedomains() arraylist dim domainlist new arraylist() ' domainlist new arraylist dim currentforest forest = forest.getcurrentforest() dim currentdomains domaincollection = currentforest.domains 'dim currentdomain string each currentdomain domain in currentdomains domainlist.add("currentdomain.name") next domainlist.trimtosize() domainlist.sort() homecoming domainlist end function protected sub selection_changed(byval sender object, _ byval e system.eventargs) handles me.load if not page.ispostback 'dropdownlist1.items.clear() dropdownlist1.datasource=domainlist dropdownlist1.databind() 'dropdownlist1.selectedindex=0 end if end sub end class
i gathered list using function below , used databind populate drop downlist. next step auto populate sec on drop downwards list auto populate users particular domain.
public function enumeratedomains() arraylist dim aldomains new arraylist() dim currentforrest forest = forest.getcurrentforest() dim mydomains domaincollection = currentforrest.domains each objdomain domain in mydomains aldomains.add(objdomain.name) next homecoming aldomains end function
asp.net vb.net arraylist
No comments:
Post a Comment