Home MVC: Search by name of the video
Reply: 0

MVC: Search by name of the video

user1468
1#
user1468 Published in July 19, 2018, 7:50 am

Hi I have a question how can I improve my code that I can search through my database by putting at least one letter in textbox not all the title. Now it's searching but I need to put whole title to search something.

My search bar:

@using (Html.BeginForm("SearchVideo", "Video", FormMethod.Post, new { @class = "navbar-form navbar-left", @role = "search" }))
                    {
                        <div class="form-group">
                            @Html.TextBox("searchVideo", (object)null, new { @class = "form-control", @placeholder = "Wyszukaj film" })
                        </div>
                        <button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
                    }

My VideoListViewModel:

public class VideoListViewModel
{
    public IEnumerable<Video> VideoList { get; set; }
}

My searching View:

    <div class="list-group">
        @foreach (var video in Model.VideoList)
        {
            <a href="/Video/GetVideo?id=@video.Id" class="list-group-item clearfix">
                <img src="~/Images/@video.ImageUrl" style="width: 80px; height: 100px; padding: 5px;" />
                Premiere: @video.Date
                <br/>
            </a>
            <br/>
        }
    </div>
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.35617 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO