Problem in server side(controller)
pass value of ids from view to controller give me null value in controller when i check in break point although it have value in client side jquery
- public ActionResult Edit(FormCollection form)
- {
-
-
- string ids = form["ids"];
- return View();
- }
This variable ids represent as text box in view and i check it in view it have values. this text box have values after i remove courses from table it send removed courses ids to text box ids .
- $("#tb").on("click", ".r", function () {
- $(this).parent().parent().hide();
- $(this).parent().prev().prev().find("input").addClass("remove");
- var ids = [];
- var i = 0;
- $(".remove").each(function () {
- ids[i] = $(this).val();
- i++;
- });
- $("#ids").val(ids);
- });
- @using (Html.BeginForm())
- {
- <div>
- <table id="tb"></table>
- <input type="submit" value="save" />
- <input type="text" name="ids" id="ids" />
- </div>
- <table id="tb">
-
- </table>
- }
see image to more clear understand enter image description here