Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I already add a javascript code in view
<label>Time of generation:</label>
<input type="text" name="daterange" value=" " />
<script type="text/javascript">
$('input[name="daterange"]').daterangepicker();
</script>


and looks ok when i run application. Now I want to add search filter for the "insert_timestamp"

private IEnumerable<view_service> get_schedule_name(string sort_order, string searchString, string current_filter, Guid? Schedule_id)
{
Models.mbt_mainEntities db = new Models.mbt_mainEntities();



string sql = string.Format(@"select a.id as Schedule_id, a.code, a.insert_timestamp, b.name
from schedule.service a
left outer join schedule.calendar b
on a.calendar_id = b.id", Schedule_id);


IEnumerable<view_service> schedule_name = db.Database.SqlQuery<models.view_service>(sql).ToList();


// searching string filter
if (current_filter == null || current_filter == "_")
current_filter = "";

ViewBag.current_filter = current_filter;

// search string in schedule_name by bus_name and driver_name
if (!String.IsNullOrEmpty(current_filter))
schedule_name = schedule_name.Where
(s => s.code.ToUpper().Contains(current_filter.ToUpper()));


//sorting order by code, name, insert_timestamp

ViewBag.code = sort_order == "code" ? "code_desc" : "code";
ViewBag.name = sort_order == "name" ? "name_desc" : "name";
ViewBag.insert_timestamp = sort_order == "insert_timestamp" ? "insert_timestamp_desc" : "insert_timestamp";

ViewBag.current_sort = sort_order;


switch (sort_order)
{

How can I implement that?

What I have tried:

Tried to add same search string that alredy exists only with starDate end endDate but I thing I didn't set it right.
Posted

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