In MVC3. I have a button class"open-deleteRowDialog" when i click on it goes to this javascript:
$(document).on("click", ".open-DeleteRowDialog", function () {
var pwd= '@Url.("GeneratePsw","Admin")';
$(".modal-body #pwd").val(pwd);
$('#1').modal('show');
})
what i want is to call a method (in controller), who has to return a string, that´s what i want to save in "var pwd" to show in a model (view)
the method (in controller) is:
public string GeneratePsw()
{
HomeBridgeEntities ddbb = new HomeBridgeEntities();
SqlConnection Cn = new SqlConnection(((System.Data.EntityClient.EntityConnection)ddbb.Connection).StoreConnection.ConnectionString);
SupPassGenerator sup = new SupPassGenerator(Cn);
//psw conteins a password from CreateRandomPassword
string psw = sup.CreateRandomPassword(9);
return psw;
}
thank you!