Recent Posts
Calendar
November 2013
S M T W T F S
« Oct    
 12
3456789
10111213141516
17181920212223
24252627282930

Posts Tagged ‘interfaces’

How to properly access controls in the Master Page

One of the great new features in ASP.NET 2.0 has been the ability to use master pages to layout the common elements of the web site.  This certainly works better than top and bottom include files or top and bottom Web User Controls.  But at least with the user controls, if we wanted to access a control within it, the method to do so was pretty straight forward.  All you had to do was expose the control as a public property.  Or, better, create a pass through property on the control that sets or retrieves the inner control’s property.  By doing this, you could turn a side bar element on or off (as an example.)

While you can expose elements of a master page in a similar manner, anyone who’s done this knows there are a few gotchas along the way.  I’m going to tell you how to avoid the gotchas and you’ll have the added benefit of being able to access the controls on the master page even if you decide to use a different master page without having to change any code other than the master page directive at the top of the aspx page.

Read the rest of this entry »

Automatic Implementation of Interfaces

videoIt’s been a while since I’ve posted a video on this site because I only do videos for things that are better explained by showing you how something works.  Most of what we’ve been looking at is code, which is better explained by using… well… just code.

But today, we need to SHOW you a feature of Visual Studio that will allow you to implement your interfaces a lot faster than you are probably use to.  In fact, I would be willing to bet that most of you don’t even know that this feature is here.

So….

Read the rest of this entry »

Reflection and Interfaces

Today is the last official installment in the series on reflection.  If you’ve been following along, you’ve probably notice that calling code in other classes using reflection is a huge pain in the butt.

Read the rest of this entry »