Referencing a datagrid control within an HTML table?

K

KatB

Hi, in order to format my web page, I'm starting to use Flow layout so
using html tables to space out controls, etc. When using grid layout,
the following worked when it was just a datagrid. I know I need to
somehow refer to the datagrid within the html table cell, but can't
figure out how.

THANKS!

Public Sub dgConfirmOrder_ItemDataBound(ByVal sender As System.Object,
ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles
dgConfirmOrder.ItemDataBound
Select Case e.Item.ItemType
Case ListItemType.AlternatingItem, ListItemType.Item
'Calculate total for the field of each row and alternating row.
myTotal += CDbl(e.Item.Cells(3).Text)
'Format the data, and then align the text of each cell to the right.
e.Item.Cells(3).Text = Format(CDbl(e.Item.Cells(3).Text),
"##,##0.00")
e.Item.Cells(3).Attributes.Add("align", "right")
Case ListItemType.Footer
'Use the footer to display the summary row.
e.Item.Cells(2).Text = "Total"
e.Item.Cells(2).Attributes.Add("align", "left")
e.Item.Cells(3).Attributes.Add("align", "right")
e.Item.Cells(3).Text = myTotal.ToString("c")
End Select
End Sub


Thanks, Kat
 
E

Eliyahu Goldin

Web controls can be always referred by id regardless where on the page they
are located.

Eliyahu
 
L

Lucas Tam

I know I need to
somehow refer to the datagrid within the html table cell

you can use the findcontrol method.

Or you can interate through the page.controls collection.
 
K

KatB

I used the exact code I provided...it worked UNTIL I put it into an HTML
table cell.

Any specific clues as to why it no longer works it, especially in light
of your answers?

Thanks, Kat
 
K

KatB

Sorry, to clarify, the calculation of the running total no longer
appears in the footer...the grid itself is there.


Thanks, Kat
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top