Hi ???
Here's some examples to get you going. Let us know if this helps?
Ken
Microsoft MVP [ASP.NET]
If Not IsPostBack Then
Dim dg As New DataGrid
dg.ID = "dg"
dg.EnableViewState = True
dg.BorderStyle = BorderStyle.Double
dg.GridLines = GridLines.Horizontal
dg.BorderWidth = Unit.Parse("3px",
System.Globalization.CultureInfo.InvariantCulture)
dg.BorderColor = Color.FromArgb(204, 188, 204)
dg.BackColor = Color.White
dg.ForeColor = Color.Black
dg.CellPadding = 4
dg.ItemStyle.ForeColor = Color.Black
dg.AutoGenerateColumns = True
dg.Font.Size = FontUnit.Point(12)
dg.Font.Underline = False
dg.FooterStyle.ForeColor = Color.FromArgb(204, 188, 204)
dg.FooterStyle.BackColor = Color.White
dg.HeaderStyle.Font.Underline = True
dg.HeaderStyle.Font.Bold = True
dg.HeaderStyle.Wrap = False
dg.ForeColor = Color.White
'.... and so on.
dg.DataSource = CreateDataSource()
dg.DataBind()
PlaceHolder1.Controls.Add(dg)
http://msdn.microsoft.com/library/de...classtopic.asp
"Eagle" <> wrote in message
news:OjGgjW%...
> Okay, I know you can set up a grid in html (see code below), but I want to
> be able to do it dynamically, can someone help with the syntax? I've
> tried:
> dg.Font = "Microsoft Sans Serif"
> dg.Font.Name="Microsoft Sans Serif"
> dg.Font.Names="Microsoft Sans Serif"
> dg.Font.Size="8pt"
> dg.Font.Size.unit=??????
>
> Can you tell me how to do all of the below in code behind? Thanks.
>
> <asp:datagrid id=dg runat="server"
> EnableViewState=True BorderStyle="Double" GridLines="Horizontal"
> BorderWidth="3px" BorderColor="#ccbccc" BackColor="White" CellPadding="4"
> AutoGenerateColumns="False">
> <FooterStyle ForeColor="#ccbccc" BackColor="White">
> </FooterStyle>
>
> <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#339966">
> </SelectedItemStyle>
>
> <EditItemStyle ForeColor="Black" BackColor="Silver" CssClass="DDL">
> </EditItemStyle>
>
> <ItemStyle ForeColor="#333333" BackColor="White">
> </ItemStyle>
>
> <HeaderStyle Font-Underline="True" Font-Bold="True" Wrap="False"
> ForeColor="White" BackColor="#cccccc">
> </HeaderStyle>
>
>