Below is my View page in which I have called action PromotionalMis and below this view code I have written my action
@using (Html.BeginForm("PromotionalMis", "Home", FormMethod.Post))
{
<div class="loginn" style="width:600px;">
<div class="logintext" style="width:154px;">
@Html.LabelFor(model => model.SongId, "Song Name")
</div>
<div class="mistype">
<select id="ddlsongs" name="ddlsongs" class="state" required="required">
</select>
</div>
</div>
<div class="loginn" style="width:600px;">
<div class="logintext" style="width:154px;">
</div>
<div class="generate">
<input type="submit" name="button" value="Generate" id="btn"/>
</div>
</div>
}
Below is my Action in Home Controller. I want to do things is that whenever I select albumname and song name from dropdownlist and when I will click on button My PromotionalMis view page should be visiblee on the same page
[HttpPost]
public ActionResult PromotionalMis(string ddlsongs)
{
if (Session["user"] != null && Session["user"].ToString() == "MISADMIN")
{
if (ddlsongs != "0")
{
string sSongName = "";
int iId = Convert.ToInt32(ddlsongs);
List<CRBT_Promotion> ss = new List<CRBT_Promotion>();
using (crbt_onwebEntities dbcontext = new crbt_onwebEntities())
{
ss = (from z in dbcontext.CRBT_Promotion where z.id == iId select z).ToList();
}
foreach (var ssname in ss)
{
sSongName = ssname.SongName.ToString();
}
Session["ss"] = sSongName;
ViewBag.songformis = sSongName;
}
return PartialView("PromotionalMis");
}
else
{
return RedirectToAction("LogOn");
}
}
@using (Ajax.BeginForm("ActionName", "Home", new AjaxOptions {HttpMethod="POST", UpdateTargetId = "filesBody" ,InsertionMode = InsertionMode.Replace}))
{
<div class="loginn" style="width:600px;">
<div class="logintext" style="width:154px;">
@Html.LabelFor(model => model.SongId, "Song Name")
</div>
<div class="mistype">
<select id="ddlsongs" name="ddlsongs" class="state" required="required">
</select>
</div>
</div>
<div class="loginn" style="width:600px;">
<div class="logintext" style="width:154px;">
</div>
<div class="generate">
<input type="submit" name="button" value="Generate" id="btnclick"/>
</div>
</div>
}
<div id="filesBody"></div
its working well
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.