views:

47

answers:

1

Hi I have a json object that i have declared in the master page. I want to push few elements in it from the ascx controls that are loaded

For. e.g.

Master page

 em = {
       d: [ { ID: "txt_Username", HelpID: "1" } ]
       }

 em.d.push({ ID: "txt_StatusUpdate", HelpID: "3" });
 em.d.push({ ID: "txt_textarea", HelpID: "4" });

This works. But the same em.d.push({ ID: "txt_StatusUpdate", HelpID: "3" }); in the javascript of ascx doesnt work. What am I doing wrong? I need to access this em object from the javascript of the master page and I need a single object that has this value pairs. What am I doing wrong here? Thoughts?

A: 

Look at the generated source code. If push method is called before em is defined, it doesn't work.

Zafer