Dear all,
I used to use pure ASP.Net code like this :
Protected Sub CmdLocateCustomer_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim S As String
If TxtCustomerID.Text.Trim = "" Then
S = "<SCRIPT>var w = 0, h = 0;if (document.all || document.layers) { w = screen.availWidth; h = screen.availHeight; }var popW = 900, popH = 500;var leftc = (w - popW) / 2, topc = (h - popH) / 2;w_Locate = window.open('Browse/LocateAllCustomerMaster.aspx?CustomerID=form1.TxtCustomerID&CustomerName=form1.TxtCustomerName&OnClick=CmdLocateCustomer','w_Locate','scrollbars=yes,left=' + leftc + ', top=' + topc + ',width=900,height=500');w_Locate.focus();</SCRIPT>"
If ClientScript.IsClientScriptBlockRegistered("s") = False Then
ClientScript.RegisterClientScriptBlock(Me.GetType(), "s", S)
End If
End If
End Sub
Now, I want to convert it into AJAX.Net.
What code do I have to use to run JavaScript code like above function ?
I tried this one :
Protected Sub CmdLocateCustomer_Click(ByVal sender As Object, ByVal e As System.EventArgs)
If TxtCustomerID.Text.Trim = "" Then
ScriptManager.RegisterClientScriptBlock(Page, Me.GetType(), "s", <SCRIPT>var w = 0, h = 0;if (document.all || document.layers) { w = screen.availWidth; h = screen.availHeight; }var popW = 900, popH = 500;var leftc = (w - popW) / 2, topc = (h - popH) / 2;w_Locate = window.open('Browse/LocateAllCustomerMaster.aspx?CustomerID=form1.TxtCustomerID&CustomerName=form1.TxtCustomerName&OnClick=CmdLocateCustomer','w_Locate','scrollbars=yes,left=' + leftc + ', top=' + topc + ',width=900,height=500');w_Locate.focus();</SCRIPT>
, True)
End If
End Sub
but failed....:'(
Thanks.