Link to home
Start Free TrialLog in
Avatar of DCRAPACCESS
DCRAPACCESS

asked on

Problem with RegisterStartupScript

Hi Experts

I use this code on many forms with out any problems:

Dim csname1 As [String] = "PopupScript"
Dim cstype As Type = Me.[GetType]()
Dim cs As ClientScriptManager = Page.ClientScript

If Session("LOG") <> "OK" Then
            Session("LOG") = "ERROR"
            If Not cs.IsStartupScriptRegistered(cstype, csname1) Then
                Dim cstext1 As New StringBuilder()
                cstext1.Append("<script type=text/javascript> alert('Only members!') </")
                cstext1.Append("script>")
                cs.RegisterStartupScript(cstype, csname1, cstext1.ToString())
            End If
      Response.Redirect("Default.aspx?ID=1")
End If

I'm using master page.

My problem is that my alert never shows. But if i remove the Redirect, there is no problem?

I'm using the exact same code on many other pages without any problems? how can that be?

ASKER CERTIFIED SOLUTION
Avatar of Swapnil
Swapnil
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DCRAPACCESS
DCRAPACCESS

ASKER

Hi netswap, i'm almost positive that i'm also doing the same on other pages too. But I found another way around. Instead of calling the script on the page i have troubles with, i'm using a session and then open the message from the master page instead and that works fine.

But you are 100% right about your comment about the rendering, that were the difference.

Thanks for your answer!