Ruga Lincy

Ruga Lincy

  • NA
  • 42
  • 7k

How to assign required field validator in red color?

Aug 24 2015 5:54 AM

hi 

below code is my view am trying to add required field validator in red color on text-boxes( txtValue, txtLocation)..

Note:

#1 ) i have set if condition in this view that you can see below.
#2 ) 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 "<i style=" padding: 0px 10px; color: #595FFF;">@Session["searched"]</i>"</h2>
</div>
<div>
@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: #009100;"> @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>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>

Answers (3)