I'm working on a Recipe Book in vb.NET but have a background in PHP. I'm trying to build up functionality to add multiple ingredients to a recipe before its saved.
In PHP I would have an auto complete input and add button. When the add button is pressed the ingredient is added to the list of ingredients (with a hidden field for the ingredient id) then when I post the recipe I would simple loop through the post data and extract the id's like this:
<div id="ingredient-list">
<div>
<input type="hidden" name="ingredient[0]" value="32" />
<span>Potatoes</span>
</div>
</div>
<div>
<input type="text" onKeyUp="IngredientSearch(this)" />
<div id="food-search-results" class="auto-complete"></div>
</div>
foreach($_POST['ingredient'] as $ingredient) {
recipe.addIngredient($ingredient);
}
However I am unsure how to accomplish such a task in .NET. Currently my add button is causing a post-back to the page (which I don't want) and adding the data to a asp:repeater. Could anyone please point me in the right direction or to a code example please.
On a side note, my next task to allow the user to upload multiple images. Which will function much the same but add a new file input when ever a file is attached to the existing input.