Asp.Net: Wizard control highlight selected step

by Pieter Brinkman 26. March 2009 06:42

You can highlight the selected stap of the wizard control by editing the SideBarTemplate within the asp:Wizard control.

<SideBarTemplate>                        
    <asp:datalist runat="Server" id="SideBarList">
        <ItemTemplate>
          <asp:linkbutton runat="server" ID="SideBarButton"/>
       </ItemTemplate>
       <SelectedItemTemplate>
           <asp:LinkButton ID="SideBarButton" runat="server" CssClass="selected">LinkButton</asp:LinkButton>
       </SelectedItemTemplate>
   </asp:datalist>
</SideBarTemplate>


The ItemTemplate and the SelectedItemTemplate need to have a Button with ID SideBarButton.

 

Tags: , , ,

ASP.Net | Controls

Asp.Net: Menu control remove MenuItem (MenuItemDataBound)

by Pieter Brinkman 26. February 2009 07:58

For a project I needed to remove menu items to the pages in the folder 'Subscriberpages' when a the user is in the Role of 'Marketing' and 'AccountManagement'. To do this I added the following code to the MenuItemDataBound event.

[code:c#]
protected void mainMenu_MenuItemDataBound(object sender, MenuEventArgs e)
{
 SiteMapNode node = e.Item.DataItem as SiteMapNode;

 if (node.Url.Contains("Subscriberpages"))
 {
  if (HttpContext.Current.User.IsInRole("Marketing") || HttpContext.Current.User.IsInRole("AccountManagement'"))
  {
   // Get menu.
   Menu topMenu = (Menu)sender;


   // Remove dataitem from menu.
   topMenu.Items.Remove(e.Item);
  }
 }
}
[/code]


To generate the menu I used the Web.sitemap and the asp:Menu control.

 

Tags: , , ,

ASP.Net | Controls

Asp.Net : Setting the DefaultButton for the LoginControl

by Pieter Brinkman 22. January 2009 08:01

You can set the DefaultButton property of the Login control by putting the Login control in a Panel and set the DefaultButton property of the panel to the LoginControlId$LoginButton.

Code example:

<asp:Panel ID="panelLogin" runat="server" 
           DefaultButton="Login1$LoginButton"> 
     <asp:Login ID="Login1" runat="server" />
</asp:Panel>

 

Cheers,
Pieter

Tags: , ,

ASP.Net | Controls

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About Me

My name is Pieter Brinkman I am a .NET Software Engineer for Achmea IT in De Meern, The Netherlands. My interests are mainly web applications created with ASP.NET, MSSQL and Silverlight.

Calendar

<<  September 2010  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar

RecentComments

Comment RSS

Most comments

club penguin cheats club penguin cheats
4 comments
us United States
Web Design Company Web Design Company
2 comments
Web design Web design
2 comments
gb United Kingdom