• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 417
  • Last Modified:

popup message box in asp.net

this is really strange
if i put this code right in pageload function, it will work fine. but if i put it in a subroutine and then call that sub in page load, it won't work at all. could you tell me why
                    ClientScript.RegisterStartupScript(Me.GetType(), "AlertBox", "alert(Error Found');", True)
0
StewSupport
Asked:
StewSupport
  • 3
  • 2
  • 2
  • +1
1 Solution
 
Juan_BarreraCommented:
Hi StewSupport,

Can you post the rest of your PageLoad and your Subroutine?
0
 
StewSupportAuthor Commented:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  
    displaypopup()
end sub

private sub displaypopup()
   ClientScript.RegisterStartupScript(Me.GetType(), "AlertBox", "alert(Error Found');", True)
end sub
0
 
jjardineCommented:
The code seems to work fine on my machine.  I tested both 2.0 and 3.0 and in the private sub it worked just fine.  Is there other code in the project or just this code?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Juan_BarreraCommented:
Same on mine, it works fine. No idea why it's not working on yours.
0
 
jjardineCommented:
Do you have any other code that is in these two functions?   When the page loads is there a javascript error being generated?  What is the difference in code output to the window?  Does the script get written?
0
 
StewSupportAuthor Commented:
no nothing just those lines.
0
 
jjardineCommented:
Are you running this locally, or on a web host or server?   What version of Visual studio and the .net framework?
0
 
tiagosalgadoCommented:
In your Alert function you're missing a quote before "Error".

ClientScript.RegisterStartupScript(Me.GetType(), "AlertBox", "alert(Error Found');", True)

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now