i’m dynamically binding an html select control with a list. The problem is , it’s not possible to declare a list in an aspx page. How can i bind each element from the list returned to the select control? The code is shown below :
<select title="select table" id="ddlTableNames" onchange="getTableName()" onload="SetTableNameToParameter()">
<!-- onload="fromHtmlDropDown()" -->
<option>Select</option>
<%
for (int i = 0; i < metaData.GetTables().Count; i++)
{
%>
<option>
<%=metaData.GetTables()[i]%></option> // I need to store the return value to something. Dont know the array syntax for this on an aspx page
<%
}
%>
</select>
I’m not 100% sure what you’re asking for here, but assuming the values contained in that returned list/array make sense to display as strings (which it looks like they do from your example), then the following might be a simpler approach :
Is this solving your problem? If not, help me understand exactly what you’re trying to solve.
Cheers,
Chris