Wednesday, March 28, 2012

Page.ClientScript.RegisterStartupScript in Ajax beta 2

----Code in Module (app_code) folder

Public Sub ShowMessage(ByVal msg As String, ByVal ObjPage As Page)

Try
Dim RegKeyname As String = "infmsg"
If ObjPage.ClientScript.IsStartupScriptRegistered(RegKeyname) Then

RegKeyname = RegKeyname & Now.GetHashCode.ToString("x")
Else
RegKeyname = "infmsg"
End If

ObjPage.ClientScript.RegisterStartupScript(ObjPage.GetType, RegKeyname, String.Format("alert('{0}');", msg), True)


Catch ex As Exception

End Try

End Sub

----------

I used to call this function from any of my asp.net Pages to display an alert message this worked till atlas july ctp now it doenst seem to work in ajax beta 2.

Note : This worked in Normal Pages as well as Pages having an Update panel

Any one any clue ... how to get it back to work

Hi Asifsolkar

I think you should use ScriptManger'sRegisterStartupScript method. There was change between CTP and BETA versions of ASP.NET AJAX ext.

(seehttp://ajax.asp.net/docs/mref/8b90a607-02c9-3c22-6cec-4628c98ccd25.aspx )

Have a nice day

Milo

No comments:

Post a Comment