Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
4
Reply
when pass variable ids from view to controller give me null
ahmed salah
Oct 28 2016 9:52 AM
267
Reply
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)
{
// check string ids give me null value although text box ids have value in view
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
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
4
)
Next Recommended Forum
Pagination In Asp.net Core 1.0
im trying to genrate id asp.net using c# in access databse