function showDataRow(rowContainerId) {

    var childControlsArray = document.getElementById(rowContainerId).childNodes;

    var StoreId, StoreName, Enabled;

    for (var i = 0; i < childControlsArray.length; i++) {

        if (childControlsArray.item(i).id == 'dvStoreId') {
            StoreId = childControlsArray[i].innerHTML;
        }
        else if (childControlsArray.item(i).id == 'dvStoreName') {
            var subchildarray = childControlsArray.item(i).childNodes;

            for (var n = 0; n < subchildarray.length; n++) {
                var hrefid = rowContainerId.replace("dvRowData", "") + "basic";

                if (subchildarray.item(n).id == hrefid) {

                    //StoreName = childControlsArray.item(i).innerHTML;
                    StoreName = subchildarray.item(i).innerHTML;

                }

            }
        }
        else if (childControlsArray.item(i).id == 'dvEnabled') {
            Enabled= childControlsArray.item(i).innerHTML;
        }

    }




    document.getElementById('EditStoreIdTxt').value = StoreId;
    document.getElementById('EditNameTxt').value = StoreName;
    // document.getElementById('EditChk').value = Enabled;

    


    $('.max').css({ 'width': 1500, 'height': 1437 });
    $('.max').fadeIn(100);
    $('.max').fadeTo("fast", 0.8);
    $('.wind').css('top', 200);
    $('.wind').css('left', 375);
    $('.wind').css('display', 'inline');
    $('.wind').fadeIn('slow');


    return false;
}

//html Repeater

<asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound">
                                        <ItemTemplate>
                                            <div id="dvRowData" runat="server" class="itemRows">                                               
                                                <div id="dvStoreId" class="w30" style="display: none">
                                                    <%# Eval("StoreId")%>
                                                </div>
                                                <div id="dvStoreName" class="w200s">
                                                <a href="#" id="basic1" runat="server">
                                                    <%# Eval("StoreName")%></a></div>
                                                <div id="dvEnabled" class="w200s" style="display: none">
                                                    <%# Eval("Enabled")%></div>
                                             
                                            </div>
                                        </ItemTemplate>
                                    </asp:Repeater>
Bohemia commented: BS +0

Recommended Answers

All 3 Replies

is this a snippet or you have a question?

it is not getting the value of the inner for loop

i would say that is because :

<div id="dvStoreName" class="w200s">
    <a href="#" id="basic1" runat="server">
        <%# Eval("StoreName")%>
    </a>
</div>

when you find dvStoreName you start looping through all its child nodes (even though there is only the <a> tag in dvStoreName) and you look for

if (subchildarray.item(n).id == hrefid)

knowing that "var hrefid = rowContainerId.replace("dvRowData", "") + "basic";"

IF the rowContainerId you called this method with was "dvRowData34" then
hrefid = "34basic"...

but all the <a> tags in all the items the repeater wrote, all have an id equal to "basic1".

So your problems are
1) all the <a> tags have id="basic1"
2) you are comparing "basic1" with "(someID)basic"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.