Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GridView

Status
Not open for further replies.

kizmar2

Programmer
May 25, 2004
164
US
Isn't there a way to do something like this:
Code:
<asp:GridView ID="myGridView" DataSourceID="mySqlDataSource" runat="server"
    AutoGenerateColumns = "False"
    AllowPaging  = "True"
    AllowSorting = "True"
    DataKeyNames = "au_id"
    CellPadding  = "4"
    ForeColor    = "#333333"
    GridLines    = "None"
  >
    <Columns>
      <asp:BoundField    HeaderText="ID"         DataField="au_id"    SortExpression="au_id"    ReadOnly="True" />
      <asp:BoundField    HeaderText="First Name" DataField="au_fname" SortExpression="au_fname" />
      <asp:BoundField    HeaderText="Last Name"  DataField="au_lname" SortExpression="au_lname" />
      <asp:BoundField    HeaderText="Address"    DataField="address"  SortExpression="address" />
      <asp:BoundField    HeaderText="City"       DataField="city"     SortExpression="city" />
      <asp:BoundField    HeaderText="State"      DataField="state"    SortExpression="state" />
      <asp:BoundField    HeaderText="Zip Code"   DataField="zip"      SortExpression="zip" />
      <asp:BoundField    HeaderText="Phone"      DataField="phone"    SortExpression="phone" />
      <asp:CheckBoxField HeaderText="Contract"   DataField="contract" SortExpression="contract" />
      <asp:CommandField
        ButtonType       = "Button"
        ShowEditButton   = "True"
        ShowDeleteButton = "True"
      />
    </Columns>
    <HeaderStyle         BackColor="#333399" ForeColor="#FFFFFF" Font-Bold="True" />
    <RowStyle            BackColor="#CCCCCC" />
    <AlternatingRowStyle BackColor="#FFFFFF" />
    <PagerStyle          BackColor="#333399" ForeColor="#FFFFFF" HorizontalAlign="Center" />
  </asp:GridView>
But build all the column headers and bind to data on the code-behind side?

I've been looking all over and can't find examples where people manually create the columns in the aspx.vb file.

KizMar
------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top