Razor VBHTML Page and Select Lists

42 Views Asked by At

I have a webpage (vbhtml) that is a single-page Razor with database content pulled. I need to create 2 select lists that depend upon each other and am at a bit of a loss as to how to accomplish this even after reading a bunch of googled-articles.

<form action="#" method="get" class="form-horizontal">
    <div class="control-group">
        <label class="control-label">Select Department</label>
        <div class="controls">
            <select id="cboDept" name="cboDept">
                @Code selectQueryString = "SELECT Dept_Id, Dept_Desc FROM Departments WHERE Tag = '" & plantName & "'"
                    For Each row In ppaDepartments.Query(selectQueryString)
                End Code
                <option value="@row.Dept_Id">@row.Dept_Desc</option>
                @Code
                    Next
                End Code
            </select>
        </div>
        <label class="control-label">Select Line</label>
        <div class="controls">
            <select id="cboLine" name="cboLine">
                @Code 
                    Dim DepartmentID As Int32
                    Dim DepartmentDesc As String = Request.Form("cboDept")

                    DepartmentID = CInt(DepartmentDesc)

                    selectQueryString = "SELECT PL_Desc, PL_Id FROM Prod_Lines WHERE Dept_ID = " & DepartmentID
                    For Each row In ppaDepartments.Query(selectQueryString)
                End Code
                <option>@row.PL_Desc</option>
                @Code
                    Next
                End Code
            </select>
        </div>
    </div>
</form>

That is my code in trying to get the Selected DEPT_ID out of the original cboDepartment dropdown value. Obviously, it is wrong and won't post-back to allow me to grab that ID - but I can't figure out what to do to allow that to happen.

0

There are 0 best solutions below