Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > How Move children from one TableCell to Another??

Reply
Thread Tools

How Move children from one TableCell to Another??

 
 
Arthur Dent
Guest
Posts: n/a
 
      06-30-2005
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.


 
Reply With Quote
 
 
 
 
Arthur Dent
Guest
Posts: n/a
 
      06-30-2005
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??



"Arthur Dent" <hitchhikersguideto-> wrote in message
news:...
> 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.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Writing move constructors and move assignment Andrew Tomazos C++ 2 12-12-2011 01:45 PM
I am trying to move spaces to a weblistbox and when I move them... Eduardo78 ASP .Net Web Controls 0 11-03-2005 06:06 PM
How Move children from one TableCell to Another?? Arthur Dent ASP .Net 1 06-30-2005 09:16 PM
TableCell oTableCell = new TableCell(); noWrap? Brian K. Williams ASP .Net 2 04-30-2004 12:04 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57