[WebMethod]
public static string FolderNameExist(string name, string id) {
DbFunctions db = new DbFunctions();
SqlCommand cmd = new SqlCommand(“SELECT * FROM Table”);
string result = db.ExecuteScalar(cmd);
return result == “0″ ? “OK!” : “*Folder name exist.”;
}
$.ajax({
type: “POST”,
url: “/FolderMgt.aspx/FolderNameExist”,
data: “{ \”name\” : \”" + $textbox.val() + “\”, \”id\” : \”" + $(“#hidId”).val() + “\” }”,
contentType: “application/json; charset=utf-8″,
dataType: “json”,
success: function(response) {
$span.html(response.d);
},
error: function(result) { alert(result.status + ‘ ‘ + result.statusText); }
});
Advertisement

Leave a comment
Comments feed for this article