Programming Journal C#, Java, SQL and to a lesser extent HTML, CSS, XML, and regex. I made this so other programmers could benefit from my experience.

Showing posts with label C# default. Show all posts
Showing posts with label C# default. Show all posts

Monday, February 18, 2008

Intercepting return in list menu items in ASP.NET

Here is how I was able to intercept the return button in my list menu item when selected, despite a default button on the aspx page:

<li><a href="" onkeydown="if (event.keyCode==13) { window.location.href='http://www.foo.com';}"</a></li>

Thursday, December 13, 2007

Handy C# tricks

Here are some handy C# tricks to increase productivity.
First, the code:

        //

        // Summary:

        //     Gets or sets a value that indicates whether the System.Web.UI.WebControls.MenuItem

        //     object is enabled, allowing the item to display a pop-out image and any child

        //     menu items.

        //

        // Returns:

        //     true if the menu item is enabled; otherwise, false.

        [Browsable(true)]

        [DefaultValue(true)]

        public bool Enabled { get; set; }

  • The [Browsable(true)] allows the properties window to display the property or event.
  • Default value does as you would expect if the variable is not directly set
  • Short cut get and sets! Simple.