Code: Html:
<input type="hidden" id="lblHierarchyType" value="" runat="server" />
C# Codebehind:
protected void Page_Load(object sender, EventArgs e)
{
if (lblHierarchyType.Value == "")
{
lblHierarchyType.Value = "AOR";
}
if (!Page.IsPostBack)
{
txtUserID.Focus();
FillGroupsList();
FillOrgTree();
ClearErrorMsgs();
}
}
Javascript:
function populateSelectedNode(node) {
debugger
var selectedOrg = node.getValue();
var hierarchyType = document.getElementById("lblHierarchyType").value;
}
The code errors out (Microsoft JScript runtime error: Object required) when it hits the assignment of lblHierarachy.value to var hierarchy.
Thanks
The ID that ASP.NET will generate will not be "lblHierarchyType" so better to change it by its ClientID
var hierarchyType = document.
getElementById("<%= lblHierarchyType.ClientID%>").value;