I am new to ASP.NET and C#.
What I am trying to do is some type of function where I can feed some argumennts, which will generate a dropdown list box for me. I know ASP.NET is much better, but I couldn't figure out how to accomplish similar or even better.
When I've done before with classic ASP/VBScript was I have a Sub routine to generate a dropdown list. Example:
Sub CreateSelectBox(selectboxID, onChangeTrigger, selectedValue, SQLTable, and SQLCondition)
' ... Query the databse from SQLTable, write a SelectBox with option values, and selected the selectedValue for arguments....
End Sub
So, all I have to do in the any submit form is just one line of code. like this:
<tr><td><%CreateSelectBox "DropDownList1", "onChangeRunJavascript123();", "Selected123", "SQL_CustomerTable", "where CustomerType = 'Consumer' order by SortOrder ASC" %></td></tr>
Please advise a better way to do this in ASP.Net C#, please provide a code sample if possible since I am new.
Thanks in advance,