Note that there are some explanatory texts on larger screens.

plurals
  1. POPicking category from one dropdownlist to show sub categories in another dropdownlist
    primarykey
    data
    text
    <p>Im trying to make a dropdownlist control another via C#. My plan is, that the first DropDownList shows categories such as "Size" "Gender" "Model" and when you pick one of those, a new DropDownList shall appear with new sub categories for the former chosen category.</p> <p>For example, if I pick "Size" a new DropDownList shal appear, with the option to choose from a number of sizes.</p> <p>Im getting an error, while testing which sounds like this: Make sure your method arguments are in right format.</p> <p>Here is what my code looks like:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using ContactTableAdapters; public partial class Test : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void ddlTwo_SelectedIndexChanged(object sender, EventArgs e) { ddlTwo.Items.Clear(); if (ddlThree.SelectedValue != "0") { Contact.CategoriesDataTable table; ddlTwo.AppendDataBoundItems = true; ddlTwo.Items.Add(new ListItem("Choose", "0")); CategoriesTableAdapter subM = new CategoriesTableAdapter(); int CategoryID = Convert.ToInt32(ddlThree.SelectedValue); //This is where I get the error table = subM.GetCategoryByCategoryID(CategoryID); foreach (Contact.CategoriesRow row in table) { string text = row.Category; string value = row.CategoryID.ToString(); ddlTwo.Items.Add(new ListItem(text, value)); } } } } </code></pre> <p>Can someone tell me, what I might have done wrong?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload