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.
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.