I want to create a dropdownlist at runtime, add it to my datatable in my dataset, then pass the whole dataset in to a session and display it in my datalist. The dropdownlist will be unique for each row in the table of the dataset. Using .NET for web development
One problem is I don't know how to refer to the Row within the asp:DropDownList - as shown below
.aspx code
[HTML]<datalist>
<datatemplate>
<asp:DropDownList id=ddl runat="server" DataTextField= "datasetColumnName" DataMember="datasettableName" AutoPostBack="true" DataSource='<%# Session("sessionname") %>' >[/HTML]
Another problem is when creating the new column I can't create it's type to a dropdownlist.
.aspx.vb code
the dataset has already been created.
Expand|Select|Wrap|Line Numbers
- dsShirts.Tables("tablename").Columns.Add("column")
- Dim ddl As New DropDownList
- Dim li1 As New ListItem(37, 1)
- ddl.Items.Add(li1)
- ds.Tables("tablename").Rows(0).Item("column") = ddl