Posts Tagged 'Webforms'

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!!!