I'm stacking with the following problem: I want to create a Template witch contains forms (3 textboxes and a button).Inside this template, through a javascript, have to call a function (CRUD method) that is inside a .cs.
So...that's one of my CRUD function in EmployeeBL.cs :
[WebMethod]
public static bool CreateEmployee(int Id, string Nome, string Cognome)
{ ...}
while here it's my Employee.tpl witch should call CreateEmployee():
<div class="container" style="max-width: 400px">
<form class="form-horizontal" method="post" id="Form"
data-bv-feedbackicons-valid="glyphicon glyphicon-ok"
data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"
data-bv-feedbackicons-validating="glyphicon glyphicon-refresh"
data-bv-submitbuttons='button[type="submit"]'>
<div class="form-group">
{Message}
</div>
<div class="form-group">
<input type="text" class="form-control" id="Id" placeholder="User name" value="{Model.Id}"
data-bv-notempty-message ="{UserNameNotEmptyMessage}" />
</div>
<div class="form-group">
<input type="text" class="form-control" id="FirstName" placeholder="First Name" value="{Model.FirstName}"
data-bv-notempty-message="{FirstNameNotEmptyMessage}" />
</div>
<div class="form-group">
<input type="text" id="LastName" placeholder="Last Name" value="{Model.LastName}" />
</div>
<div class="form-group">
<button type="submit" class="btn btn-default" value="Submit" id="myButton" >Create Employee</button>
</div>
Now always inside this tpl put a script like here:
<script type="text/javascript">
$(document).ready(function ()
{
$("#Form").bootstrapValidator();
$("#myButton").click(function(){
var Id=foo($('#Id').val());
var FirstName= foo($('#FirstName').val());
var LastName=foo($('#LastName').val());
});
});
Summarizing: i need to create an Employee (with Id,LastName,FirstName) that goes to write on my DB via clicking on Button So my question is how to set visible the namespace of EmployeeBL.cs and how to call it's method CreateEmployee() inside script (clicking on Button)? Thx in advance!!
this should work