dropdownlist binding from function in code behind aspx vb
- by Dr.H
so I have this working in C# , why it is not working in VB
public string[] CustomizedRoles()
{
int length = Roles.GetAllRoles().Length;
string[] arrRoles=Roles.GetAllRoles();
string[] customizedRoles= new string[length+1];
customizedRoles[0] = "";
for (int i = 1; i < length+1; i++)
{
customizedRoles[i] = arrRoles[i-1];
}
return customizedRoles;
}
asp:GridView....
asp:DropDownList ID="ddlOwnerRolesUpdate" runat="server" DataSource="<%# CustomizedRoles() %" Height="25px" Width="177px" SelectedValue='<%# Bind("Owner") %'
where is "Owner" is a data value come from a datasource for the grid
it is working fine in C# .
in Vb with the same aspx and this code behind it is not working.
Public Function CustomizedRoles() As String()
Dim length As Integer = Roles.GetAllRoles().Length
Dim arrRoles As String() = Roles.GetAllRoles()
Dim _customizedRoles As String() = New String(length + 1) {}
_customizedRoles(0) = " "
For index As Integer = 1 To length
_customizedRoles(index) = arrRoles(index - 1)
Next
Return _customizedRoles
End Function
can anyone show me how to bind array of string to a dropdownlist from aspx to code behind in VB