am new to mvc. i need your help. i am trying to implement a search result page.. still now am getting proper result. but i need to implement navigation bar on bottom of the page. i need to show 10 results per page, so i choose grid view.
http://prntscr.com/8a52t0
http://prntscr.com/8a534t
check this link you can see my search result page
how can i implement navigation bar, what i mean is << < 1 2 3 > >> for my search result page, how can i handle 50 results by 10 results per page.
view :
<div class="searchform cf">
@using (Html.BeginForm())
{
<input type="search" name="txtValue" id="txtValue" value="@Session["searched"]" placeholder="Need Service ? ">
<input type="search" name="txtLocation" id="txtLocation" value="@Session["location"]" placeholder=" City or State">
<button type="submit" value="Search" style="margin-top: 5px;" onclick="validatetextbox()">Search</button>
}
</div>
<div>
<h2 style="font-size: 15px;">Searched for "<i style=" padding: 0px 10px; color: #595FFF;">@Session["searched"]</i>"</h2>
</div>
<div style="margin: 35px 0px 0px 90px; height:500px;">
@if (Model != null)
{
if (Model.Count() != 0)
{
<div class="">
@foreach (var item in Model)
{
<div class="tiptext">
<b style="margin-left: 0px; font-size: large;color: #1A0DB2;">@item.BusinessName</b>
<h3 style="margin: 5px 0px 5px 0px;color: rgb(0, 145, 0);"> @item.FirstName</h3>
<h3 style="margin: 8px; color:black">@item.BusinessCategory </h3>
<div class="description">
<div class="description_image">
<img src="~/Images/popup_pointer.jpg" />
<div class="POP_UP_outer">
<div class="description_background">
<div class="description_map">
<b>Map</b>
</div><hr />
<div class="description_body">
<b>Description </b><h4 class="des">@item.BusinessDescription</h4>
<b>Address2 </b><h4 class="des">@item.Address1</h4>
<b>Email </b><h4 style="color:blue; margin: 5px 0px 5px 0px;">@item.EmailID </h4>
<b>WorkNumber </b><h4 class="des">@item.WorkNumber</h4>
<b>MobileNumber </b><h4 class="des">@item.MobileNumber</h4>
<b>City </b><h4 class="des">@item.City</h4>
<b>State </b><h4 class="des">@item.State</h4>
<b>ZipCode </b><h4 class="des">@item.ZipCode</h4>
@Html.ActionLink("Book An Appointment", "CalendarView", "Appt", new { id = @item.UserID }, null)
@*@Html.ActionLink("Book An Appointment", "Popup", "Search", new { @class = "openDialog", data_dialog_id = "aboutlDialog", data_dialog_title = "Additinal Customer" })*@
</div>
</div>
</div>
</div>
</div>
</div>
}
</div>
}
else
{
<label id="lblErrorMsg" title="Record not fount...!" style="color:red;">Record not found...!</label>
}
}
</div>
</div>
controller
public ActionResult Index(string txtValue, string txtLocation)
{
var s = txtValue.ToString();
Session["searched"] = s;
var l = txtLocation.ToString();
Session["location"] = l;
if (txtValue.Length > 0)
{
string[] keywords = txtValue.Trim().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
string[] keyword = txtLocation.Trim().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
var parameter = new SqlParameter[2];
parameter[0] = new SqlParameter { ParameterName = "@SEARCH", Value = txtValue };
parameter[1] = new SqlParameter { ParameterName = "@loc", Value = txtLocation };
List<Search> cm = new List<Search>();
using (SYTEntities context = new SYTEntities())
{
cm = context.Database.SqlQuery<Search>("exec search_filter_sp @SEARCH,@loc", parameter).ToList();
}
return View(cm);
}