raphael232
Programmer
Hi, i have the following formview:
I need to be able to update the dropdownlist control to add in the categories for my page. Before (when i did not use a formview) i would have put:
in my page load event handler but now i have moved it within my formview it doesn't seem to work. Appreciate if someone could tell me how to fix this. Thanks
Code:
<asp:FormView ID="FormView1" runat="server" DataSourceID="ObjectDataSource1" DefaultMode="Insert">
<InsertItemTemplate>
Title: <asp:TextBox ID="txtTitle" runat="server"></asp:TextBox>
Category: <asp:DropDownList ID="lstCategoryID" runat="server">
</asp:DropDownList>
</InsertItemTemplate>
</asp:FormView>
I need to be able to update the dropdownlist control to add in the categories for my page. Before (when i did not use a formview) i would have put:
Code:
Dim items As New ListItemCollection
Dim topItem As New ListItem
topItem.Text = "-- Please Select --"
topItem.Value = ""
items.Add(topItem)
lstCategoryID.DataSource = Utilities.GetCategoriesList(items, 0, "")
lstCategoryID.DataTextField = "Text"
lstCategoryID.DataValueField = "Value"
lstCategoryID.DataBind()
in my page load event handler but now i have moved it within my formview it doesn't seem to work. Appreciate if someone could tell me how to fix this. Thanks