i wish to search records in the gridview but it is not redirecting to the method which iam pointing to what would be the problem can any one help me out with this?
#Dal
- public void SearchRecord(string searchBy,string txtSearch)
- {
- try
- {
- EmployeeEntity emp = new EmployeeEntity();
- using (AdventureWorksEntities empDbentity = new AdventureWorksEntities())
- {
- if ( searchBy=="Name")
- {
- var result=empDbentity.tblEmployees.Where(x=>x.Empname.StartsWith(txtSearch) || txtSearch==null).ToList();
- }
- else{
- var result=empDbentity.tblEmployees.Where(x=>x.Empid==Convert.ToInt32(txtSearch)||txtSearch==null).ToList();
- }
- }
- }
- catch (Exception ex)
- {
- Log.WriteError("BorrowerImageGridView.EmployeeDataAcess.searchRecord()", ex);
- throw new Exception(TUtil.GetMethodExceptionContext(searchBy, txtSearch), ex);
- }
#bll
- public void SearchRecord(string searchBy, string txtSearch)
- {
- try
- {
- empdata.SearchRecord(searchBy, txtSearch);
- }
- catch (Exception ex)
- {
- throw new Exception(TUtil.GetMethodExceptionContext(searchBy, txtSearch), ex);
- }
- }
#contoller
- [HttpGet]
- public ActionResult SearchRecord(string searchBy,string txtSearch)
- {
- empservice.SearchRecord(searchBy,txtSearch);
- return RedirectToAction("EmployeeDetails");
- }
#view
- @using (Html.BeginForm("SearchRecord", " Employee", FormMethod.Get))
- {
- class="input-group">
- Search By:
- @Html.RadioButton("searchBy", "Empname", true)Name
- @Html.RadioButton("searchBy", "Empid")EmployeeId
- @Html.TextBox("txtSearch", "", new { @id = "txtSearch", @class = "form-control", style = " margin-bottom: 25px ;align-content:center; font-family:Arial, FontAwesome", placeholder = "Search" })
- @*"text" class="form-control" id="txtSearch" placeholder="Search for...">*@
- class="input-group-btn">
- class="btn btn-secondary" style="margin-bottom:4px;"type="submit">class="glyphicon glyphicon-search">
- @*"txtSearch" style=" margin-bottom: 25px ;font-family:Arial, FontAwesome" type="text" placeholder=" ? Search " name=" search">
- class="btn btn-info" style=" margin-bottom: 25px">
- class=" glyphicon glyphicon-search">
- Search
- *@
- }
Ruchi SharavatPosted Apr 19, 2018, 8:14 AM
Kaushik DhameliyaPosted Apr 19, 2018, 5:44 AM
sangeetha kPosted Apr 19, 2018, 4:32 AM
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.Requested URL: / Employee/SearchRecord