Find <td> inside RadMenu

2 posts, 0 answers
  1. Terri-Lynn
    Terri-Lynn avatar
    45 posts
    Member since:
    Dec 2010

    Posted 21 Oct 2011 Link to this post

    Hi all!  I have a simple RadMenu that displays a static (not pulled from any sort of datasource) list of menu items like so:
    <telerik:RadMenu ID="RadMenu1" runat="server" EnableShadows="true">
        <Items>
            <telerik:RadMenuItem Text="" PostBack="false" ImageUrl="~/i/opendata.png" NavigateUrl="data.aspx">
                <Items>
                    <telerik:RadMenuItem Width="400px">
                        <ItemTemplate>
                            <div id="CatWrapper" class="Wrapper" style="width: 380px;">
                                <h3> Our Data</h3>
                                <table>
                                    <tr>
                                        <td valign="bottom"><a href="dfaq.aspx"><img src="i/faq_24.png" alt="FAQ" /></a>
                                        </td>
                                        <td width="175px"><a href="dfaq.aspx">Data FAQ</a></td>
                                        <td valign="bottom"><a href="maps.aspx"><img src="i/map_24.png" alt="Maps" /></a></td>
                                        <td><a href="mapcat.aspx">Maps</a></td>
                                    </tr>
                                    <tr>
                                        <td valign="bottom" align="right"><a href="dldsoptions.aspx"><img src="i/globe_download_24.png" alt="Dowload Datasets" /></a>
                                        </td>
                                        <td><a href="dldsoptions.aspx">Download Datasets</a></td>
                                        <td valign="bottom"><a href="otherdata.aspx"><img src="i/link_24.png" alt="Other Data Links" /></a>
                                        </td>
                                        <td><a href="otherdata.aspx">Other Data Links</a></td>
                                    </tr>
                                    <tr id="sde">
                                        <td valign="bottom" id="sdeimgcell" runat="server" visible="false"><a href="sde.aspx"><img src="i/_engine_24.png" alt="SDE" /></a></td>
                                        <td id="sdelinkcell" runat="server" visible="false"><a href="sde.aspx" >Access Data</a></td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                </table>
                            </div>
                        </ItemTemplate>
                    </telerik:RadMenuItem>
                </Items>
            </telerik:RadMenuItem>
        </Items>
    </telerik:RadMenu>

    The last item I have set to visible="false" because I want to ensure in the code-behind that the user SHOULD see it, based on a role.  I can't for the life of me figure out how to "find" the <td id="sdelinkcell"...>!  Anyone?  I need to make it visible for one role, but I'm stumped!
  2. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 26 Oct 2011 Link to this post

    Hi Terri-Lynn,

    You can find the table data on the client-side using jQuery as explained in these forums:
    http://stackoverflow.com/questions/376081/how-to-get-a-table-cell-value-using-jquery
    http://stackoverflow.com/questions/640903/jquery-how-can-i-find-if-an-id-has-a-specific-string

    Please take a look the attached runnable page. You should also note that when you place any control in a template its Id changes therefore if you need to directly find the desired table data you will need to use the newly rendered Id (as explained in my comments).

    Greetings,
    Kate
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top