@{ string id = "0"; if (ViewData["rid"] != null) { id = ViewData["rid"].ToString(); } string[] str = { "All", "Price Above 500", "Price Below 500" }; if (id == "0") { @Html.RadioButton("RId", 0, true) @str[0].ToString(); @Html.RadioButton("RId", 1) @str[1].ToString(); @Html.RadioButton("RId", 2) @str[2].ToString(); } else if (id == "1") { @Html.RadioButton("RId", 0) @str[0].ToString(); @Html.RadioButton("RId", 1, true) @str[1].ToString(); @Html.RadioButton("RId", 2) @str[2].ToString(); } else { @Html.RadioButton("RId", 0) @str[0].ToString(); @Html.RadioButton("RId", 1) @str[1].ToString(); @Html.RadioButton("RId", 2, true) @str[2].ToString(); } } <script type="text/javascript"> $(':radio[name=RId]').change(function () { var value = $(this).val(); window.location = "/Registration/ComputerScienceBooks/" + value.toString(); }); </script>
public ActionResult ComputerScienceBooks(string id) { ViewData["rid"] = id; DataTable dt = new DataTable(); if (id == null) { dt = registerDAL.BookDetails("Computer Science", "0"); } else { dt = registerDAL.BookDetails("Computer Science", id); } if (dt.Rows.Count == 0) { ViewBag.emptyMessage = "No Book Available"; } return View(ConvertDataTabletoIEnumerable(dt)); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)