how to get the value of a selectedItem ? I ve tried :

@using (Html.BeginForm("Index","Product", FormMethod.Post , new { @class = "pure-form pure-form-stacked" }))

    <label for="state">Category</label>
                        <select name="cat" id="cat" class="pure-input-1-2" style="width:200px!important">

                            <option value="99">All Categories...</option>
                            <option value="100">In Promotion </option>

                            @foreach (var c in categories)

        <option value="@c.idCategory"></option>



and in my Controller I have this Method using FormCollection :

public ActionResult Index(FormCollection collection)

                int cat = Int32.Parse(collection["cat"]);

                var result = utOfW.ProductRepository.GetMany(p => p.category.idCategory==cat).ToList();

                return View(result);
                return View();

it seems to be Ok but it does not work !! SomeOne have an Idea ? Thankxxx...

Related posts

Recent Viewed