Reputation: 542
I have a C# file that contains some code, and I want to refer to it in my Razor HTML page, using the code below:
@{
var check = new pingDevice();
}
//In the main HTML page:
<button onclick="@check.pingDevice().isConnected()">Ping Devices (See Console)</button>
When I try to, however, I get the following error:
CS0246: The type or namespace name 'pingDevice' could not be found (are you missing a using directive or an assembly reference?)
I have the CS file included in my Bin folder, but I still get the same error.
What am I doing wrong? Should I be using a different method of including code in my Razor project?
Upvotes: 0
Views: 197
Reputation: 27944
This will probably work:
<button onclick="@check.isConnected()">Ping Devices (See Console)</button>
check is a pingDevice, it probably does not have a function pingDevice().
Upvotes: 2