Showing posts with label If Statement. Show all posts
Showing posts with label If Statement. Show all posts

Monday, April 25, 2011

GridView DataControlRowType

"DataControlRowType Enumeration (System.Web.UI.WebControls)" ( http://bit.ly/fA1sJ6 )

There are several different row types in a Gridview, each with its own function. When using an event such as RowDataBound (where individual rows are of interest to us), it is important to check for the DataControlRowType.

  • Header
  • Footer
  • DataRow
  • Separator
  • Pager
  • EmptyDataRow     

We can do so. The following example checks for a DataRow (a normal row of data):

If e.Row.RowType = DataControlRowType.DataRow Then

    ' Code...

End If

Wednesday, October 27, 2010

Why hide object state?

By restricting access to an objects internal state via getter behaviors, we can ensure that all values are valid before assigning them to internal state.

For instance, the Player class has a state called Name. If an external object has direct access to this state, there is the possibility that an incorrect or invalid value may be assigned to it, however, if that state can only be modified via a setter behavior, the behavior implementation (code) can check the value for its validity before assigning the value to the Name state. Eg. Is the name the correct length, type, etc.

Making a Program Choose Between Two Possibilities: The If...Then Statement

MSDN http://msdn.microsoft.com/en-au/library/whz9yas9.aspx