I'm working with a VB.Net page which calls a web method from JavaScript, this was working upto a week ago and now for some reason is not working. I was wondering if anyone could give me any idea where to look as I am completely lost right now.
Firstly my page generates a list of items that can be clicked, The line that does this is:
TicketHTML = TicketHTML + "<td><img src='../images/delete.png' Class='imgTicketClose' alt='Delete Task' onclick='DeleteTicket(" + row("id").ToString() + ")' /></td></tr>"
I know this is working as when the item is clicked I get a javascript popup so I would assume the problem is not here.
Now my Javascript:
function DeleteTicket(ticketID)
{
var answer = confirm("Do you really want to delete this task?")
if (answer)
{
PageMethods.DeleteTask(ticketID);
window.location.reload()
}
}
I assume the problem is here as the web method never seems to call and the page doesnt seem to reload either, but I dont understand why this would be failing if the javascript displays the confirm dialog.
In the interest of completeness here is my web method though I know this is not being called as I have profiled the database.
<System.Web.Services.WebMethod()>
Public Shared Sub DeleteTask(ticketID As Integer)
Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("Blueprint").ToString())
Dim cmd As New SqlCommand
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "spDeleteNonTicketItem"
cmd.Parameters.AddWithValue("@ItemID", ticketID)
cmd.Connection = conn
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
End Sub
So where could I look? Any advice would be greatly appreciated. Thanks
EDIT: Could anything in the web.config file be preventing page methods from executing? I have just noticed this happening with a completely seperate web method and have checked the integers being passed into the javascript with an alert() and they are all valid