Tech blog

Thursday, August 11, 2005

Now I'm an MCP

I passed 70-315 yesterday; it was easier than I expected.
What I didn't expect was that I'd actually learn a few things from the test. For example:
  1. The DataGrid class (control) has a read-only property named Columns of type DataGridColumnCollection.

    The DataGridColumnCollection type is a collection of objects derived from DataGridColumn (such as BoundColumn).

    DataGridColumn has a read-only property named ItemStyle of type TableItemStyle.

    The TableItemStyle class has a property named CssClass.

    So, setting datagrid.columns[0].ItemStyle.CssClass = "myClass" can be done in the page-in-front as:

    <asp:DataGrid runat="server" id="datagrid">
    <Columns>
    <asp:BoundColumn DataField="name">
    <ItemStyle CssClass="myClass" />
    </asp:BoundColumn
    >
    </Columns
    >
    </asp:DataGrid>

    or

    <asp:DataGrid runat="server" id="datagrid">
    <Columns>
    <asp:BoundColumn DataField="name" ItemStyle-CssClass="myClass"/>
    </Columns>
    </asp:DataGrid>

  2. Using the RequiredFieldValidator's InitialValue is useful when you want the user to select any item except the first in a drop down list.

0 Comments:

Post a Comment

<< Home