Web Forms RegisterStartupScript Fails

I have been working on MVC for close to 4 years now and have been out of touch with Web Forms. In one of our product (web forms grrrrrrrrrrr) I had to help our my team who was facing a weird problem.

ClientScript.RegisterStartupScript block was not registering the javascript at all….We tried numerous methods (load, prerender etc) but it always failed. That is when my team mate found that the form tag is missing the runat=server and it worked!!!

So this if for people who are facing the exact same problem. Add the runat server to your form tag for your clientscript or startupscript to work.

Happy Programming!!!

Cheers,

Raja

Advertisements

0 Responses to “Web Forms RegisterStartupScript Fails”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s





%d bloggers like this: