Can I use javascript to call server side function in ASP.NET

I have a datagrid and allow to delete function. But before delete the record, I want to popup a message(using javascript alert message) to confirm to delete record. If user select "Yes"  then, I want to call a server side function to check whether the record can be delete or not. 

So, my problem is start from calling the server side function using javascript. Is it possible to do that. If so, please give me a solution/help. Else any idea to solve the problem???
Below is part of my code to do the delete record command:-
Private Sub Delete(ByVal Source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.DeleteCommand
Dim strScript As String = ""
RegisterStartupScript("focus", strScript)

Dim strLocationID As String = e.Item.Cells(2).Text

[COLOR=Red] If txtbox.Text = "Yes" Then
'Do a lot of coding here and call function
' Do nothing
End If[/COLOR]
End Sub

***Notice the code in red color, it suppose to put inside a (serverside??)function and to be call by javascript function(notice the blue (*)marks), because it will run the code when page is rendered.

Thank you for help and comments.
0 EDUStreet 1/20/2005 10:15:43 AM

Thread closed