Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
0
Reply
model not passing data to controller from modal popup
S P
Jun 1 2017 2:06 PM
530
Reply
I have generated a partial view inside bootstrap modal popup which searches for the data from textbox on click of search Button within that modal popup.
I am using Ajax.BeginForm to send the data. But still my controller doesn't get the data i am paasing. I am using @Html.TextBoxFor in the view.(MVC)
Modal Popup View
@using (Html.BeginForm(FormMethod.Post))
{
<input type="button" class="aslink modal-link" data-toggle="modal" data-target="#modal2" id="btnSearchModal" value="Search company" onclick="SearchModal()">
@using (Ajax.BeginForm("_ModalSearch", "controller", new AjaxOptions() { UpdateTargetId = "Search" }))
{
<div id="Search">
@using (Html.BeginFormGroup(m => m.CompanyName))
{
@Html.TextBoxFor(m => m.CompanyName)
}
</div>
}
My Controller
public ActionResult _ModalSearch()
{
var model = new CompanyModel();
RefreshCompanyModel();
return PartialView("_OperatorSearch",model);
}
[HttpPost]
public ActionResult _ModalSearch(CompanyModel model)
{
var companyResults = GetCompanyResults(model);
return PartialView("_OperatorSearch", companyResults);
}
so when i am inserting any value into textbox from modal popup view, it should pass to controller via model which is not working here.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
Please convert and give me the below code to c#
dictionary concept