Drop down list not displaying items
-
Hi, I am working with VB.NET on .NET 1.1, and I am not too familiar with it. When I add a drop down list to the .aspx page, it creates the following code in the page behind: Protected WithEvents ddlID As System.Web.UI.WebControls.DropDownList Now I want to go and populate this drop down in a method like this: ddlID = Me.CreateDropDownListForFileFields(columns) columns are the columns from a dataset and the function CreateDropDownListForFileFields creates items for all the columns and returns a drop down list. ..but ddlID does not display anything. Why is this? Please can some help? Regards ma se
-
Hi, I am working with VB.NET on .NET 1.1, and I am not too familiar with it. When I add a drop down list to the .aspx page, it creates the following code in the page behind: Protected WithEvents ddlID As System.Web.UI.WebControls.DropDownList Now I want to go and populate this drop down in a method like this: ddlID = Me.CreateDropDownListForFileFields(columns) columns are the columns from a dataset and the function CreateDropDownListForFileFields creates items for all the columns and returns a drop down list. ..but ddlID does not display anything. Why is this? Please can some help? Regards ma se
u have to specify the datasource, do databind, specify datavalue and datatext field ddlist.DataSource = dataset1.Tables(0) ddlist.DataBind() ddlist.DataValueField = "column name" ddlist.DataTextField = "column name"
Thanks Warm Regards Prakash-B
-
u have to specify the datasource, do databind, specify datavalue and datatext field ddlist.DataSource = dataset1.Tables(0) ddlist.DataBind() ddlist.DataValueField = "column name" ddlist.DataTextField = "column name"
Thanks Warm Regards Prakash-B
You don't understand!! I have the following piece of code: Protected WithEvents ddlID As System.Web.UI.WebControls.DropDownList In a method where I try to populate this drop down list: ddlID = Me.CreateDropDownListForFileFields(columns) CreateDropDownListForFileFields looks like this: Private Function CreateDropDownListForFileFields(ByVal columns As DataColumnCollection) As DropDownList Dim ddl As New DropDownList Dim column As DataColumn For Each column In columns ddl.Items.Add(New ListItem(column.ColumnName, column.ColumnName)) Next ddl.Items.Insert(0, New ListItem("Please select...", String.Empty)) ' Return Return ddl End Function Please see if you can help me know. Regards ma se
-
You don't understand!! I have the following piece of code: Protected WithEvents ddlID As System.Web.UI.WebControls.DropDownList In a method where I try to populate this drop down list: ddlID = Me.CreateDropDownListForFileFields(columns) CreateDropDownListForFileFields looks like this: Private Function CreateDropDownListForFileFields(ByVal columns As DataColumnCollection) As DropDownList Dim ddl As New DropDownList Dim column As DataColumn For Each column In columns ddl.Items.Add(New ListItem(column.ColumnName, column.ColumnName)) Next ddl.Items.Insert(0, New ListItem("Please select...", String.Empty)) ' Return Return ddl End Function Please see if you can help me know. Regards ma se
This question really should have been asked in the ASP.NET forum, reguardless of the language you used. But, in Windows Forms, any control must be added to the form's
Controls
collection. I'm guessing that the same is true for an ASP.NET Form.Me.Controls.Add(ddl)
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007