reading the innerhtml of unorderedlist from server side

I would like to parse the unorderedlist innerhtml and parse the string. When I try to get the innerhtml from code behind as follows , I only get "\r\n   ".

I can add elements to the unordered list through code behind and javascript as follows:

foreach (DataRow auditUser in auditUsers.Rows)
            {
                //for each user in the audit , add a li to the unordered list, kinda similar to doing this in javascript addtouserlist function
                string li = "<li class='username' id ='" + auditUser["AuditMgmtUser_ID"] + "'>";
                string deleteCtl = "<a href='#' class='removelink' onclick ='return removeuser(" + auditUser["AuditMgmtUser_ID"] + ");'>x</a>";
                li += auditUser["firstname"] + deleteCtl + "</li>";
                ulSelectedUsers.InnerHtml += li;
            }  

 function adduserToList(userId, userName) {
        selectedUsers.push(userId);
       
        var li = $("<li></li>").text(userName).addClass("username");
        $(li).attr("id", userId);

        var deleteCtl = $("<a>").text("x");
        $(deleteCtl).attr({
            href: "#",
            class: "removelink"
        });

        $(deleteCtl).attr("onclick", "return removeuser(" + userId + ")");
        $(li).append(deleteCtl);

        var selectedusersul = "<%=ulSelectedUsers.ClientID%>";
        $("#" + selectedusersul).append(li);
    }

Please help. Thanks

TrialUserAsked:
Who is Participating?
 
Atique AnsariCommented:
I guess its typing mistake. Your code has InnerHtml, it should be innerHTML.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.