I am using an html <select>
(not the server control) on my asp.net webform, which I bound using asp.net ajax via a webservice call. In my webservice I basically do this:
Private Function GetStores() As String
dim stores as DataTable = GetStores()
dim html as new StringBuilder
for each row as DataRow in stores.Rows
html.append("<option>")
html.append(row("store"))
html.append("</option>")
next
return html.tostring()
End Function
From my js, I would then simply use:
$get("myddl").innerHTML = "<select>" + result + "</select>";
The reason why I do this is because the server is faster in creating the required HTML. If I were to fill the ddl from the client-side by just returning the dataTable, then I think it will take a bit longer, depending on the rows.
Also please note that I do this only once when the page is loaded.
What do you think about this? Is this bad? If yes, why?