Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
iam tryed this code but no

What I have tried:

HTML
@using System.Data
@model DataTable


<input type="text" name="Datecall" id="Datecall" placeholder="Date" required="" />
<input type="button" id="btnsearch" name="btnsearch" class="form-control" value="Chart" style="color:green" />

<table cellpadding="5" id="employeeTable" cellspacing="5" border="1">
    <tr style="background-color:aliceblue">
        <th>EmployeeName</th>
        <th>Duplecated</th>
    </tr>
    @foreach (DataRow dr in Model.Rows)
    {
        <tr>
            <td>@dr["EmployeeName"]</td>
            <td>@dr["Duplecated"]</td>
        </tr>
    }
</table>

this is error message
Uncaught ReferenceError: ko is not defined

C#
public ActionResult xternal(string Datecall)
        {
            DataTable dt = new DataTable();
            string str = "Data Source=MAHGOUBND4;Initial Catalog=CTC_Mahgoub;Persist Security Info=True;User ID=sa;Password=ah987987987;";
            using (SqlConnection cn = new SqlConnection(str))
            {
               
                using (SqlCommand cmd = new SqlCommand(" SELECT EmployeeName, COUNT(EmployeeName) as 'Duplecated'  FROM [dbo].[cs] WHERE Datecall LIKE 'Datecall' GROUP BY EmployeeName HAVING COUNT(EmployeeName) > 1; "))

                {
                    cmd.Connection = cn;
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dt);
                    }
                }
            }
            return View(dt);

        }
Posted
Updated 13-Sep-20 4:30am
Comments
Richard MacCutchan 13-Sep-20 10:00am    
Which line of code produces the error message?
silantmagicbbb 13-Sep-20 10:21am    
i have problem in my view I want compensation for Datecall value in Datecall text how i can do it
Richard Deeming 15-Sep-20 4:59am    
FYI, the word is "duplicated", not "duplecated" or "dublecated". :)

1 solution

Quote:
Uncaught ReferenceError: ko is not defined

This error likely occurs when the Knockout Javascript library is not referenced on your web page.

Try something like on the page:
HTML
<script src="http://knockoutjs.com/downloads/knockout-3.0.0.debug.js" type="text/javascript"></script>

Similar errors and solve:
Uncaught ReferenceError: ko is not defined[^]
javascript - ReferenceError: ko is not defined when loading from jQuery - Stack Overflow[^]
knockout.js - JavaScript Runtime error 'ko' is undefined - Stack Overflow[^]
 
Share this answer
 

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