ASP.NET C# - A function with arguments to write dropdownlist
<p>I am new to ASP.NET and C#.  </p>

<p>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.</p>

<p>When I've done before with classic ASP/VBScript was I have a Sub routine to generate a dropdown list.
Example:</p>

<pre><code>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
</code></pre>

<p>So, all I have to do in the any submit form is just one line of code. like this:</p>

<pre><code>&lt;tr&gt;&lt;td&gt;&lt;%CreateSelectBox "DropDownList1", "onChangeRunJavascript123();", "Selected123", "SQL_CustomerTable", "where CustomerType = 'Consumer' order by SortOrder ASC" %&gt;&lt;/td&gt;&lt;/tr&gt;
</code></pre>

<p>Please advise a better way to do this in ASP.Net C#, please provide a code sample if possible since I am new.</p>

<p>Thanks in advance,</p>
