Click here to Skip to main content
15,910,118 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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);
            }
Posted
Updated 28-Aug-15 22:37pm
v2
Comments
OriginalGriff 29-Aug-15 4:59am    
Don't "bump" your question.
It's rude, unnecessary and it doesn't help you get an answer any faster. In fact it can slow it down, because when you are rude, you annoy people...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900