TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
S P
NA
285
213.9k
model not passing data to controller from modal popup
Jun 1 2017 2:06 PM
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.
Reply
Answers (
0
)
Please convert and give me the below code to c#
dictionary concept