How Move children from one TableCell to Another??

A

Arthur Dent

Heres the deal... i have a datagrid which displays products in a category.
Any category has its own set of columns which show up in the grid, so it is
defined as AutoGenerateColumns=True

There is a static column which has a textbox and button for entering a qty
and
adding the item to your shopping cart.

The client INSISTS that the qty/order controls be on the right of the grid,
which
means i need to somehow either put the static column at the end of the grid,
or fake it.

I understand the static columns CANT go at the end. So what i want to do is
return one
extra column at the end of my dynamic columns (easy) and then MOVE the
qty/order
controls from the static column cell into the last dynamic column cell, and
hide the static.
SOUNDS easy, but i cant get it to work.... heres my code:

Private Sub grdProds_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
grdProds.ItemCreated
Dim i As DataGridItem = e.Item
i.Cells(0).Visible = False '// tblOrder HOST (qty textbox and order
button)
i.Cells(1).Visible = False '// ID
i.Cells(2).Visible = False '// PRICE

Select Case i.ItemType
Case ListItemType.Item, ListItemType.AlternatingItem
Dim tbl As Control = i.FindControl("tblOrder")
tbl.Parent.Controls.Remove(tbl)
i.Cells(i.Cells.Count - 1).Controls.Add(tbl)
End Select
End Sub

How can i move the tblOrder control (HTMLTable) from one cell to another??
Thanks in advance,
- Arthur Dent.
 
A

Arthur Dent

I sort of got around this. I moved the code from ItemCreated to
ItemDatabound.
Then it wouldnt rerun though on postbacks. So then i moved it to
grdProds_PreRender.
Only problem now is that the postbacks dont work. I think because the
clientids are all messed up now??
 

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

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top