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
Gaurav Kapahi
NA
182
0
How to store selected drop down list value as global in MVC
Sep 16 2013 1:40 AM
I have three dropdowns all are coming from partialview .....first and sec dropdown load on page load, third one depends upon passing first and second dropdown value as parameter in third but as I am not using any event on first or loading third one on the click of second dropdown I am only getting second dropdwon value in parameter not first one, can anyone help me in same... I am using Ajax.BeginForm in dropdownlist.
First DropDown
@Html.DropDownListFor(
m => m.SelectedYearId,
new MultiSelectList(ViewBag.Years,"YearID", "Years"),
"Select Year",new { Multiple = "multiple", @class = "multiselect", style = "width: 250px"}
)
Second Drop Down
@model WebReports.Models.Entities
@using (Ajax.BeginForm("LoadCompbyMatchType", "ICC", new AjaxOptions { UpdateTargetId = "Comp" }))
{
@Html.HiddenFor(m => m.SelectedYearId)
@Html.HiddenFor(m => m.SelectedReportId)
@Html.DropDownListFor(
m => m.SelectedMatchTypeId,
new MultiSelectList(ViewBag.MatchType, "MatchTypeID", "MatchTypeName"),
"Select a Match Type",new { Multiple = "multiple", @class = "select", style = "width: 250px"}
)
}
Third Drop Down
@if (ViewBag.Comp != null)
{
using (Ajax.BeginForm("LoadMatchbyComp", "ICC", new AjaxOptions { UpdateTargetId = "Match" }))
{
@Html.HiddenFor(m => m.SelectedYearId)
@Html.HiddenFor(m => m.SelectedMatchTypeId)
@Html.DropDownListFor(
m => m.SelectedCompId,
new SelectList(ViewBag.Comp,"CompetitionID", "CompetitionName"),
string.Empty
)
}
}
<script type="text/javascript">
$('#SelectedCompId').change(function ()
{
$(this).parents('form').submit();
});
</script>
<script type="text/javascript">
$('#SelectedMatchTypeId').change(function ()
{
$(this).parents('form').submit();
});
[HttpPost]
public ActionResult LoadCompbyMatchType(IEnumerable(string) SelectedMatchTypeId, IEnumerable(string)
SelectedYearId
)
{
}
Not Able to get SelectedYearId
Reply
Answers (
0
)
can one guide how can use "ajax" technology in windows phone
GridViewItem Dynamic Image