Need help changing a Custom iMIS Webpage

We have some custom webpages made by ASI, this one in particular is a list of companies. We want to be able to list their subsidiaries as a compact list. With the code I have currently inserted, which is some simple javascript and then tagged the unordered list id to match the javascript function. Anyway, this insert only works for the first company on the list when you pull up the webpage. My question is, why doesn't this work for every company in the list if they are all output recursivly by this code block? I would appreciate any help or ideas, thank you.

 

<script type="text/javascript" language="javascript1.2" src="http://www.piaa.us/newsbriefs/listCollapse.js"></script>
<script type="text/javascript" language="javascript1.2">
window.onload = function ()
{
  compactMenu('compact',true,'&plusmn; ');
}
</script>

    <asp:Panel ID="resultList" runat="server">
        <h2><asp:Label ID="ResultHeading" runat="server" Text="Label"></asp:Label></h2>       
        <asp:DataList ID="results" runat="server">
            <ItemTemplate> 

            <ul id="compact">
                <asp:LinkButton ID="link" runat="server" CssClass="titleHeader" CommandName='<%# DataBinder.Eval(Container.DataItem,"id") %>' OnCommand="detail_click">
                    <li><%# DataBinder.Eval(Container.DataItem, "company")%></asp:LinkButton>
                       <ul>
                          <li>Subsidiary Companys</li>
                      </ul>
                    </li>                  
              </ul>    
     
            </ItemTemplate> 
        </asp:DataList>       
    </asp:Panel>

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

ID must be unique

Probably because the ID values are not unique.  Browsers/Javascript won't usually crash when you have duplicate IDs on the same page, but you get behavior like this where only the first or last item works.

Try changing something like this:

<asp:LinkButton ID="link<%# DataBinder.Eval(Container.DataItem,"ID") %>" runat="server"...

--
Bruce Wilson
Director, Technical Services
McGladrey LLP

Bruce, Thank you for the

Bruce,

Thank you for the suggestion, that actually makes perfect sense, I will try something like what you suggested so the IDs are unique.

No Luck with Dynamic ID

I have tried several different combinations of entering a unique number(imis ID) after that ID of link. I get an error everytime I try to run the page. I did hours of research yesterday trying to find a way to dynamically delcare the ID there but no luck. I even tried just using the imis is by itself as the ID and that did not work either, apparently it cannot be just number, it needs at least 1 character. For example the ID="L2" works but not ID="2" and all of the imis IDs are numbers.

Justin Walcott

IT & Database Analyst

PIAA

I have seen some examples of

I have seen some examples of unique CSS classes using the same technique (appending the ID number to the end of the CSS class) and using JS to select via the class. Do you think that might work?

CSS solution

Andrea,

That is an idea worth trying, I will do some research on using CSS to increment the ID and try it. Thanks