Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to customize the user control for only one page of the ASP.NET website?
    primarykey
    data
    text
    <p>I have two user controls (ascx); one contains some forms, and the other one contains the menu bar.</p> <p>I used both of them in many pages. Now, I need to customize the one that has the menu bar for the Admin Homepage. So, is it possible to add some changes to the user control just for this page.</p> <p>I mean by changes, adding two elements to the menu bar.</p> <p>For instance, let us assume that the two pages are called: Admin, Settings. How will you customize the user control for them? </p> <p>My code for the Menu User Control (ascx file):</p> <pre><code>&lt;div class="topnav"&gt; &lt;ul class="menu" runat="server" &gt; &lt;li&gt;&lt;a href="Default.aspx"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Sub-Menu1&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;Item&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Item&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Item&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Item&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#x"&gt;Sub-Menu2&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;Item&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Item&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Item&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Item&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Item &lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Item&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Item&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;ITEM&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="About.aspx"&gt;About&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="Contact.aspx"&gt;Contact Us&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Help&lt;/a&gt;&lt;/li&gt; &lt;li class="menuItem1ToHide"&gt;&lt;a href="#"&gt;Admin&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class="clr"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>And inside the Master Page, I put:</p> <pre><code>&lt;uc1:MenuBar ID="MenuBar1" runat="server" /&gt; </code></pre> <p>As you see from above code, I added the Admin page as the last element in the list, and the code-behind class, I added the bool method mentioned below, but I don't know how to make the last element only visible for the Admin rather than the other users</p> <p><strong>By the way, I am using the ASP.NET Role-Based Security since I am using the Windows Authentication. This to define the Admin from the Normal User.</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload