below code is my view am trying to add required field validator in red color on text-boxes( txtValue, txtLocation).. Note: i have set if condition in this view that you can see below. textboxes are called in ID
<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;">Search</button> } </div> <div style="margin: 35px 0px 0px 90px"> @if (ViewBag.Message == true) { <label id="lblMessage" title="Please enter keyword" style="color:red;">Please enter keyword...!</label> } else { if (Model != null) { if (Model.Count() != 0) { <div> <h2 style="font-size: 15px;">Searched for "@Session["searched"]"</h2> </div> <div> @foreach (var item in Model) { <div class="tiptext"> Map </div><hr /> <div class="description_body"> ^__b>ZipCode <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>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)