asp.net dropdown databinding using codeview
I am trying to bind my dropdownlist control using codeview.
My .aspx page contains the dropdownlist code s/w like this
<asp:dropdownlist id="ddCategory" DataSource="<%# fnGetData() %>" />
My CodeView contains definition to fnGetData and returns IDataSource
Protected Function fnGetData() as IDataSource
//I fetched some data and bound into a dropdown list
//and simply returned the dropdownlist
ddNewCategory.DataSource=hashTable 'HashTable is already initialized
ddNewCategory.DataTextField="Text"
ddNewCategory.DataValueField="Value"
ddNewCategory.DataBind()
Return ddNewCategory
End Function
But the problem returned is...
Unable to cast object of type System.Web.UI.WebControls.Dropdownlist to type System.Web.UI.IDataSource
How can I bind my dropdown list using codeview?

