As I said it was a strange problem and yes it was indeed.
I finally took a brand new ASP.NET page (.aspx) and kept adding html and javascript in bits and pieces from the original. So did I add the server code in the (aspx.vb) file. At a point, I was facing the same problem, with the hidden controls again reporting null.
In the code behind (vb), I was writing RegisterClientS criptBlock instead of RegisterStartup Script,...
User Profile
Collapse
-
Actually, the code i posted above is the source code. When it is run with VB.NET and the values are substituted by the server code, "runat" goes off. So, the "name" attribute gets assigned. This all can be seen when we "view source" the rendered html page.
...Code:<html> <head> <script language="javascript"> function Print() { alert(document.getElementById('hdnMyHidden'));Leave a comment:
-
Tried that, no luck.
runat, attribute is used for accessing the variable in VB.NET server code.Leave a comment:
-
Strange problem with hidden variables being found 'null' by Javascript
Javascript is not recognising any of the hidden variables on this web form. It simply reports them to be null. I tried declaring a new variable without "runat=serv er". No luck.
...Code:<html> <head> <script language="javascript"> function Print() { alert(document.getElementById('hdnMyHidden')); alert(document.getElementById('hdnMyHidden').value);
No activity results to display
Show More
Leave a comment: