1
Answer

display id and name and designation on separated lines instead using s

ahmed salah

ahmed salah

1y
737
1

0

 

I work on asp.net MVC web API . I face issue when call web API using jQuery ajax request

my issue is autocomplete result display separated by slash

Id - Name - Designation

but expected result I need to get is :

Id : 121

Name : michel nicol

Designation : It Manager

Meaning I need to display Id on First line and second line I will display Name and Third Line I will display Designation .

so every property will be on one line instead of using slash separated .

full code details

$("#txtDirectManagerId").autocomplete({
        source: function (request, response) {
            var searchTextDirectManager = $("#txtDirectManagerId").val();
            console.log("search text" + searchTextDirectManager)
            $.ajax({
                url: '@Url.Action("GetAllEmployeeBasedSearchTextDirectManager", "Resignation")',
                data: { searchTextDirectManager: searchTextDirectManager },
                method: "GET",
                dataType: "json",
                success: function (data) {

                    response($.map(data, function (item) {



                            label: "File No : " + item.EmployeeID + " - " + "Name :" + item.EmployeeName + " - " +
                                "Designation : " + item.Designation, value: item.EmployeeID, employeeName: item.EmployeeName
                        };
                    }))

                }
            });
        },
        position: { my: "right top", at: "right bottom" },
        appendTo: '#searchContainerDirector',
        select: function (event, ui) {

            $("#DirectManagerName").val(ui.item.employeeName);
        },
        minLength: 4,

    });
Markup

 

html controls used on autocomplete

<div class="col-md-7">
                   @Html.EditorFor(model => model.LineManager, new { htmlAttributes = new { @class = "form-control", id = "txtLineManagerId" } })
                   <div id="searchContainer">

                   </div>

               </div>
<div class="col-md-7">


 </div>
Markup
Answers (1)
1
Navaneeth Krishnan

Navaneeth Krishnan

606 1.8k 422.1k 4y
please use jquery mask plugin
 
https://igorescobar.github.io/jQuery-Mask-Plugin/
 
hope this will help you. please let me know if need. 
1
Paul Rajs

Paul Rajs

NA 641 154.1k 4y
Hi Navaneeth Krishnan , thnks for your reply ... its working , but the out put is like XXXX-XX64-2252 but i my expected output is 8693-3764-2252 , how can i get this output and dave it to the databae , kindly suggest me bro ... sorry for the inconvenience ,
 
thanking you 
Paul.S 
 
0
Navaneeth Krishnan

Navaneeth Krishnan

606 1.8k 422.1k 4y
https://stackoverflow.com/questions/33315390/masking-the-values-in-a-textbox-using-jquery
0
Chirag Rathod

Chirag Rathod

NA 151 2.5k 4y
Using Replace keyword replace first few character with 'X'.
 
https://www.dotnetperls.com/replace