473,382 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

How Move children from one TableCell to Another??

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.
Nov 19 '05 #1
1 1662
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" <hi*********************@yahoo.com> wrote in message
news:Oq**************@TK2MSFTNGP12.phx.gbl...
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.

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Randy | last post by:
Hello All, Is there any way to make this happen... Say I want to make a table with 3 rows. The first row has two TableCells each with a width of 300. The second row has one TableCell with the...
2
by: George Durzi | last post by:
Consider this pseudo HTML from a web form <asp:Table> <asp:TableRow> <asp:TableCell> <asp:Table> <asp:TableRow> <asp:TableCell></asp:TableCell> <asp:TableCell></asp:TableCell>...
3
by: Andre | last post by:
Hi, Did someone know why this code does'nt work (The TableCell Width). The cell don't have 600 and 150 like writed in width="600" and width="150". <asp:datagrid id="DataGrid1" ...
6
by: hb | last post by:
Hi, I have a page bill.aspx and its code-behind bill.aspx.cs. On bill.aspx I have: === Select a month: <asp:dropdownlist runat="server" id="lstDate" autopostback="True" /> <br> <asp:table...
0
by: Diane Yocom | last post by:
I'm very new to ASP.Net and probably jumped in a little over my head, but... I'm trying to create a user control that will control navigation through my site. It's sortof like Amazon.com, where...
2
by: somequestion | last post by:
how can i solve this problem i really wanna apply background image into the <asp:TableCell> but it's not allow i think i use asp.net 2.0 give me some help..please
7
by: david | last post by:
I have asked this question before. But it does not work for me. Given radion buttons in the web form design page. What I did is described as follows. A panel control is dragged into the design...
2
by: zeeshanks | last post by:
Hello, I cannot move the table from one point to another. It seems its fixed. I checked the properties and it looks fine to me. Following is the html code for the table: <asp:table id="Table2"...
0
by: DanG | last post by:
During grid field validation, I would like to generate a message for the user to tell which column had the error. So I have a control (textbox, dropdownlist, checkbox, etc.), and would like to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.