Hi micah,
I have created sample that full-fill your requirement.
HTML
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
Inches
</td>
<td>
<asp:DropDownList ID="ddlInches" runat="server" OnSelectedIndexChanged="SelectedIndexChanged"
AutoPostBack="true" Width="150px">
<asp:ListItem Text="Select" Value="Select" />
<asp:ListItem Text="5inches" Value="5inches" />
<asp:ListItem Text="6inches" Value="6inches" />
<asp:ListItem Text="9inches" Value="9inches" />
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
Category
</td>
<td>
<asp:DropDownList ID="ddlCategory" runat="server" OnSelectedIndexChanged="SelectedIndexChanged"
AutoPostBack="true" Width="150px">
<asp:ListItem Text="Select" Value="Select" />
<asp:ListItem Text="Machin mold" Value="Machin mold" />
<asp:ListItem Text="Hand mold" Value="Hand mold" />
<asp:ListItem Text="Hollow" Value="Hollow" />
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
Item
</td>
<td>
<asp:DropDownList ID="ddlItem" runat="server" OnSelectedIndexChanged="SelectedIndexChanged"
AutoPostBack="true" Width="150px">
<asp:ListItem Text="Select" Value="Select" />
<asp:ListItem Text="block" Value="block" />
<asp:ListItem Text="Interlock" Value="Interlock" />
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
Quantity
</td>
<td>
<asp:DropDownList ID="ddlQuantity" runat="server" Width="150px">
</asp:DropDownList>
</td>
</tr>
</table>
C#
protected void SelectedIndexChanged(object sender, EventArgs e)
{
ddlQuantity.Items.Clear();
if (ddlInches.SelectedIndex > 0 && ddlCategory.SelectedIndex > 0 && ddlItem.SelectedIndex > 0)
{
string inches = ddlInches.SelectedItem.Text;
string category = ddlCategory.SelectedItem.Text;
string item = ddlItem.SelectedItem.Text;
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[6] {
new DataColumn("ID"), new DataColumn("UserName"), new DataColumn("Inches"),
new DataColumn("Category"), new DataColumn("Item"), new DataColumn("qty") });
dt.Rows.Add(1, "mic33", "5inches", "Machin mold", "block", "30");
dt.Rows.Add(2, "mic33", "6inches", "Hand mold", "Interlock", "70");
dt.Rows.Add(3, "mic33", "9inches", "Hollow", "block", "120");
DataRow[] dr = dt.Select("Inches = '" + inches + "' AND Category = '" + category + "' AND Item = '" + item + "'");
if (dr.Length > 0)
{
string quantity = dr[0].ItemArray[5].ToString();
ddlQuantity.Items.Insert(0, new ListItem("Select", "Select"));
ddlQuantity.Items.Insert(1, new ListItem(quantity, quantity));
ddlQuantity.Items.FindByText(quantity).Selected = true;
}
}
}
VB.Net
Protected Sub SelectedIndexChanged(sender As Object, e As EventArgs)
ddlQuantity.Items.Clear()
If ddlInches.SelectedIndex > 0 AndAlso ddlCategory.SelectedIndex > 0 AndAlso ddlItem.SelectedIndex > 0 Then
Dim inches As String = ddlInches.SelectedItem.Text
Dim category As String = ddlCategory.SelectedItem.Text
Dim item As String = ddlItem.SelectedItem.Text
Dim dt As New DataTable()
dt.Columns.AddRange(New DataColumn(5) {New DataColumn("ID"), New DataColumn("UserName"), New DataColumn("Inches"), New DataColumn("Category"), New DataColumn("Item"), New DataColumn("qty")})
dt.Rows.Add(1, "mic33", "5inches", "Machin mold", "block", "30")
dt.Rows.Add(2, "mic33", "6inches", "Hand mold", "Interlock", "70")
dt.Rows.Add(3, "mic33", "9inches", "Hollow", "block", "120")
Dim dr As DataRow() = dt.[Select]((Convert.ToString((Convert.ToString((Convert.ToString("Inches = '") & inches) + "' AND Category = '") & category) + "' AND Item = '") & item) + "'")
If dr.Length > 0 Then
Dim quantity As String = dr(0).ItemArray(5).ToString()
ddlQuantity.Items.Insert(0, New ListItem("Select", "Select"))
ddlQuantity.Items.Insert(1, New ListItem(quantity, quantity))
ddlQuantity.Items.FindByText(quantity).Selected = True
End If
End If
End Sub
Screenshot