J
James Page
Hi all
I am creating a dynamically populated html e-mail that sends out order
details after an order has been placed. The records are retrieved via linq
and, as far as the data is concerend, everything works fine.
The e-mail is constructed of a gridView and 2 detailViews.
To create the gridView I'm using:
Public Shared Function createGridView() As GridView
Dim cartGrid As GridView = New GridView
cartGrid.AutoGenerateColumns = False
cartGrid.ShowFooter = False
cartGrid.ShowHeader = True
cartGrid.Width = Unit.Pixel(750)
cartGrid.BorderWidth = Unit.Pixel(1)
cartGrid.HeaderStyle.BackColor = Drawing.Color.FromName("#669900")
cartGrid.HeaderStyle.ForeColor = Drawing.Color.Black
cartGrid.HeaderStyle.HorizontalAlign = HorizontalAlign.Center
cartGrid.HeaderStyle.Font.Name = "Arial"
cartGrid.HeaderStyle.Font.Size = FontUnit.Point(12)
cartGrid.HeaderStyle.Font.Bold = True
Dim cartGridColumn As New BoundField
cartGridColumn.HeaderText = "Product description"
cartGridColumn.DataField = "description_short"
cartGridColumn.ItemStyle.Width = Unit.Pixel(550)
cartGridColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Left
cartGridColumn.ItemStyle.Font.Name = "Arial"
cartGridColumn.ItemStyle.Font.Size = FontUnit.Point(12)
cartGrid.Columns.Add(cartGridColumn)
......other boundFields here
Return cartGrid
End Function
Using a getHtmlFromControl function the gridView is rendered and will
display as expected in the resultant e-mail.
However, I'm having problems with the detailsView.
Here's the code:
Public Shared Function createOrderSummary() As DetailsView
Dim orderSummaryview As DetailsView = New DetailsView
orderSummaryview.AutoGenerateRows = True
orderSummaryview.ForeColor = Drawing.Color.Black
orderSummaryview.BackColor = Drawing.Color.White
orderSummaryview.Font.Name = "arial"
orderSummaryview.Width = Unit.Pixel(500)
orderSummaryview.HeaderStyle.BackColor =
Drawing.Color.FromName("#669900")
orderSummaryview.HeaderText = "Order total"
orderSummaryview.HorizontalAlign = HorizontalAlign.Center
Dim orderSummaryRow As New BoundField
orderSummaryRow.HeaderText = "Goods"
orderSummaryRow.DataField = "subTotal"
orderSummaryRow.DataFormatString = "{0:c}"
orderSummaryRow.ItemStyle.Width = Unit.Pixel(150)
orderSummaryRow.HeaderStyle.Width = Unit.Pixel(150)
orderSummaryRow.ItemStyle.HorizontalAlign = HorizontalAlign.Right
orderSummaryRow.HeaderStyle.HorizontalAlign = HorizontalAlign.Left
....other boundFields here
Return orderSummaryview
End Function
Using the same render method as used for the gridView the only thing being
returned from the getHtmlFromControl is the header text!
I'm stumped - can anyone shed some light on what i'm missing here?
I am creating a dynamically populated html e-mail that sends out order
details after an order has been placed. The records are retrieved via linq
and, as far as the data is concerend, everything works fine.
The e-mail is constructed of a gridView and 2 detailViews.
To create the gridView I'm using:
Public Shared Function createGridView() As GridView
Dim cartGrid As GridView = New GridView
cartGrid.AutoGenerateColumns = False
cartGrid.ShowFooter = False
cartGrid.ShowHeader = True
cartGrid.Width = Unit.Pixel(750)
cartGrid.BorderWidth = Unit.Pixel(1)
cartGrid.HeaderStyle.BackColor = Drawing.Color.FromName("#669900")
cartGrid.HeaderStyle.ForeColor = Drawing.Color.Black
cartGrid.HeaderStyle.HorizontalAlign = HorizontalAlign.Center
cartGrid.HeaderStyle.Font.Name = "Arial"
cartGrid.HeaderStyle.Font.Size = FontUnit.Point(12)
cartGrid.HeaderStyle.Font.Bold = True
Dim cartGridColumn As New BoundField
cartGridColumn.HeaderText = "Product description"
cartGridColumn.DataField = "description_short"
cartGridColumn.ItemStyle.Width = Unit.Pixel(550)
cartGridColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Left
cartGridColumn.ItemStyle.Font.Name = "Arial"
cartGridColumn.ItemStyle.Font.Size = FontUnit.Point(12)
cartGrid.Columns.Add(cartGridColumn)
......other boundFields here
Return cartGrid
End Function
Using a getHtmlFromControl function the gridView is rendered and will
display as expected in the resultant e-mail.
However, I'm having problems with the detailsView.
Here's the code:
Public Shared Function createOrderSummary() As DetailsView
Dim orderSummaryview As DetailsView = New DetailsView
orderSummaryview.AutoGenerateRows = True
orderSummaryview.ForeColor = Drawing.Color.Black
orderSummaryview.BackColor = Drawing.Color.White
orderSummaryview.Font.Name = "arial"
orderSummaryview.Width = Unit.Pixel(500)
orderSummaryview.HeaderStyle.BackColor =
Drawing.Color.FromName("#669900")
orderSummaryview.HeaderText = "Order total"
orderSummaryview.HorizontalAlign = HorizontalAlign.Center
Dim orderSummaryRow As New BoundField
orderSummaryRow.HeaderText = "Goods"
orderSummaryRow.DataField = "subTotal"
orderSummaryRow.DataFormatString = "{0:c}"
orderSummaryRow.ItemStyle.Width = Unit.Pixel(150)
orderSummaryRow.HeaderStyle.Width = Unit.Pixel(150)
orderSummaryRow.ItemStyle.HorizontalAlign = HorizontalAlign.Right
orderSummaryRow.HeaderStyle.HorizontalAlign = HorizontalAlign.Left
....other boundFields here
Return orderSummaryview
End Function
Using the same render method as used for the gridView the only thing being
returned from the getHtmlFromControl is the header text!
I'm stumped - can anyone shed some light on what i'm missing here?