|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Position of a dynamic tableBy C#-code I want to place a table UNDER my last WEB control - witch I placed
with the designer. My problem is that the table is inserted in the topleft of the IE window - on top of my other WEB controls. I think the controls must have a position-property but I can't find it. Hi,
It should display dynamic table at the end of all controls. And you might have created "Table" dynamically not "HtmlTable", that's why it is not displaying Align Property. If you use HtmlTable instead Table then you have Align Property which you can declare to "Center". Like: public void createTable() { HtmlTable t = new HtmlTable(); for (int j = 1; j < 3; j++) { HtmlTableRow row = new HtmlTableRow(); // Iterate through the cells of a row. for (int i = 0; i < 4; i++) { // Create a new cell and add it to the Cells collection. HtmlTableCell cell = new HtmlTableCell(); cell.Controls.Add(new LiteralControl("row " + j.ToString() + ", cell " + i.ToString())); row.Cells.Add(cell); } t.Rows.Add(row); t.Align = "Center"; } this.Controls.Add(t); } You can call this function from anywhere in your code. Regards, Mansi Shah. *** Sent via Developersdex http://www.developersdex.com *** Thanks Mansi Shan for your time BUT ...
I want to use "Table" - not "HtmlTable" - and it will work if I place a "Table" in the right position by "Design view" and then by code adds rows and cells. When I can place it this way by "Design view" then "Table" must have a position-propterty somewhere, I think - that's the one I'm looking for. How can I find it ? Best regards KSor, Denmark Show quote "Mansi Shah" wrote: > > Hi, > > It should display dynamic table at the end of all controls. > > And you might have created "Table" dynamically not "HtmlTable", that's > why it is not displaying Align Property. > If you use HtmlTable instead Table then you have Align Property which > you can declare to "Center". Like: > > public void createTable() > { > HtmlTable t = new HtmlTable(); > for (int j = 1; j < 3; j++) > { > HtmlTableRow row = new HtmlTableRow(); > // Iterate through the cells of a row. > for (int i = 0; i < 4; i++) > { > // Create a new cell and add it to the Cells > collection. > HtmlTableCell cell = new HtmlTableCell(); > cell.Controls.Add(new LiteralControl("row " + > j.ToString() + ", cell " + i.ToString())); > row.Cells.Add(cell); > } > t.Rows.Add(row); > t.Align = "Center"; > } > this.Controls.Add(t); > } > > You can call this function from anywhere in your code. > > Regards, > Mansi Shah. > > *** Sent via Developersdex http://www.developersdex.com *** > |
|||||||||||||||||||||||