Hello,
in my init I am adding some controls into a
placeholder. The complete procedure looks like this:
Dim iLoop As Integer = 0
Dim table As New Table
table.BackColor = System.Drawing.Color.Gainsboro
table.CellPadding = 2
table.CellSpacing = 0
Dim tr As New TableRow
For iLoop = 0 To dsHeaderLinks.Tables(0).Rows
().Count() - 1
Dim td As New TableCell
td.ID = dsHeaderLinks.Tables(0).Rows(iLoop)
("ID")
If iLoop = 0 Then
td.Attributes.Add("class", "SelectedCell")
Else
td.Attributes.Add
("class", "UnSelectedCell")
End If
Dim link As New HyperLink
link.Font.Bold = True
link.Text = " " &
dsHeaderLinks.Tables(0).Rows(iLoop)("LinkText")
& " "
link.NavigateUrl = "/intranet" &
dsHeaderLinks.Tables(0).Rows(iLoop)("Link") & "?Index=" &
dsHeaderLinks.Tables(0).Rows(iLoop)("ID")
link.ToolTip = IIf(IsDBNull
(dsHeaderLinks.Tables(0).Rows(iLoop)("LinkTooltip" )), "",
dsHeaderLinks.Tables(0).Rows(iLoop)("LinkTooltip") )
td.Controls.Add(link)
tr.Controls.Add(td)
Next
table.Controls.Add(tr)
HeaderMenuHolder.Controls.Add(table)
Now in my pageload I need to get access to the Tablecells,
so that I can set a new class for them. What would be the
best way to do that?
Thanks 3 1464
The best way would be to hold on to a referene to them...it'll be faster and
cleaner.
private cells as new ArrayList()
OnInit
.....
tr.Controls.Add(td)
cells.Add(td)
....
end oninit
OnLoad
for each cell as HtmlTableCell in cells
cell....
next
end onload
Karl
--
MY ASP.Net tutorials http://www.openmymind.net/
"Anonymous" <an*******@discussions.microsoft.com> wrote in message
news:05****************************@phx.gbl... Hello,
in my init I am adding some controls into a placeholder. The complete procedure looks like this:
Dim iLoop As Integer = 0 Dim table As New Table table.BackColor = System.Drawing.Color.Gainsboro table.CellPadding = 2 table.CellSpacing = 0
Dim tr As New TableRow
For iLoop = 0 To dsHeaderLinks.Tables(0).Rows ().Count() - 1 Dim td As New TableCell td.ID = dsHeaderLinks.Tables(0).Rows(iLoop) ("ID")
If iLoop = 0 Then td.Attributes.Add("class", "SelectedCell") Else td.Attributes.Add ("class", "UnSelectedCell") End If
Dim link As New HyperLink link.Font.Bold = True link.Text = " " & dsHeaderLinks.Tables(0).Rows(iLoop)("LinkText") & " " link.NavigateUrl = "/intranet" & dsHeaderLinks.Tables(0).Rows(iLoop)("Link") & "?Index=" & dsHeaderLinks.Tables(0).Rows(iLoop)("ID") link.ToolTip = IIf(IsDBNull (dsHeaderLinks.Tables(0).Rows(iLoop)("LinkTooltip" )), "", dsHeaderLinks.Tables(0).Rows(iLoop)("LinkTooltip") )
td.Controls.Add(link) tr.Controls.Add(td) Next
table.Controls.Add(tr) HeaderMenuHolder.Controls.Add(table)
Now in my pageload I need to get access to the Tablecells, so that I can set a new class for them. What would be the best way to do that?
Thanks
Hi,
why are you using Controls collection to add cells in rows?
You should use:
tr.Cells.Add(td)
instead of:
tr.Controls.Add(td)
Then, you can declare the htmltable variable at Class-Level
Public Class MyControl
Dim table As New Table
...
In this way you can access it from both OnInit and OnLoad. Then you can
iterates its cells using Rows and Cells collections, for example:
table.Rows(rowindex).Cells(cellindex)
HTH
Bye
Stefano
"Anonymous" <an*******@discussions.microsoft.com> ha scritto nel messaggio
news:05****************************@phx.gbl... Hello,
in my init I am adding some controls into a placeholder. The complete procedure looks like this:
Dim iLoop As Integer = 0 Dim table As New Table table.BackColor = System.Drawing.Color.Gainsboro table.CellPadding = 2 table.CellSpacing = 0
Dim tr As New TableRow
For iLoop = 0 To dsHeaderLinks.Tables(0).Rows ().Count() - 1 Dim td As New TableCell td.ID = dsHeaderLinks.Tables(0).Rows(iLoop) ("ID")
If iLoop = 0 Then td.Attributes.Add("class", "SelectedCell") Else td.Attributes.Add ("class", "UnSelectedCell") End If
Dim link As New HyperLink link.Font.Bold = True link.Text = " " & dsHeaderLinks.Tables(0).Rows(iLoop)("LinkText") & " " link.NavigateUrl = "/intranet" & dsHeaderLinks.Tables(0).Rows(iLoop)("Link") & "?Index=" & dsHeaderLinks.Tables(0).Rows(iLoop)("ID") link.ToolTip = IIf(IsDBNull (dsHeaderLinks.Tables(0).Rows(iLoop)("LinkTooltip" )), "", dsHeaderLinks.Tables(0).Rows(iLoop)("LinkTooltip") )
td.Controls.Add(link) tr.Controls.Add(td) Next
table.Controls.Add(tr) HeaderMenuHolder.Controls.Add(table)
Now in my pageload I need to get access to the Tablecells, so that I can set a new class for them. What would be the best way to do that?
Thanks
Thanks -----Original Message----- Hi,
why are you using Controls collection to add cells in
rows?You should use: tr.Cells.Add(td) instead of: tr.Controls.Add(td)
Then, you can declare the htmltable variable at Class-
Level Public Class MyControl Dim table As New Table ...
In this way you can access it from both OnInit and
OnLoad. Then you caniterates its cells using Rows and Cells collections, for
example:table.Rows(rowindex).Cells(cellindex)
HTH
Bye
Stefano
"Anonymous" <an*******@discussions.microsoft.com> ha
scritto nel messaggionews:05****************************@phx.gbl... Hello,
in my init I am adding some controls into a placeholder. The complete procedure looks like this:
Dim iLoop As Integer = 0 Dim table As New Table table.BackColor = System.Drawing.Color.Gainsboro table.CellPadding = 2 table.CellSpacing = 0
Dim tr As New TableRow
For iLoop = 0 To dsHeaderLinks.Tables(0).Rows ().Count() - 1 Dim td As New TableCell td.ID = dsHeaderLinks.Tables(0).Rows(iLoop) ("ID")
If iLoop = 0 Then td.Attributes.Add
("class", "SelectedCell") Else td.Attributes.Add ("class", "UnSelectedCell") End If
Dim link As New HyperLink link.Font.Bold = True link.Text = " " & dsHeaderLinks.Tables(0).Rows(iLoop)("LinkText") & " " link.NavigateUrl = "/intranet" & dsHeaderLinks.Tables(0).Rows(iLoop)("Link") & "?Index="
& dsHeaderLinks.Tables(0).Rows(iLoop)("ID") link.ToolTip = IIf(IsDBNull (dsHeaderLinks.Tables(0).Rows(iLoop)
("LinkTooltip")), "", dsHeaderLinks.Tables(0).Rows(iLoop)("LinkTooltip") )
td.Controls.Add(link) tr.Controls.Add(td) Next
table.Controls.Add(tr) HeaderMenuHolder.Controls.Add(table)
Now in my pageload I need to get access to the
Tablecells, so that I can set a new class for them. What would be
the best way to do that?
Thanks
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Michael |
last post by:
Need some help trying to read values from web controls - specifically
*finding* the controls (like a drop down list) - that are added
dynamically added within an asp:panel control.
The page...
|
by: TM |
last post by:
What is the method used to find all asp.net server controls (run at server)
such as TextBox, ListBox, CheckBox... currently defined on an Asp.Net page
at run time. I need it inside of a controlled...
|
by: TomislaW |
last post by:
How to find all user controls (ascx) loaded on a Page?
|
by: tshad |
last post by:
How do I find (and set) a couple of labels in the Footer after a DataGrid is
filled?
I have a bunch of DataGrids that get displayed nested inside a DataList.
The datagrid looks like:
...
|
by: Sacha Korell |
last post by:
I'm trying to load a drop-down list with all DropDownList control names from
another page.
How would I be able to find those DropDownList controls? The FindControl
method will only find a...
|
by: sck10 |
last post by:
Hello,
I am using the code below to set the values of a DetailsView template field
using FindControl. My question is how would you find a control if its a
Boundfield control?
For example,...
|
by: madani |
last post by:
Hi,
I made custom web control. this control have an Event like "TestEvent",
How can I find out if properties of other controls of parent Page is
changed inside this event when I fire that event...
|
by: usenet |
last post by:
How and where can one find out about the basics of VB/Access2003
syntax?
I am a died in the wool C/C++/Java Linux/Unix programmer and I am
finding it difficult to understand the program format...
|
by: DC |
last post by:
Hi,
our cms (asp.net 2.0) dynamically inserts controls into asp.net pages,
sometimes 50 and more per page, and if we run into a performance
bottleneck we have a hard time finding out which...
|
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= |
last post by:
i have a master page and aseries of controls labeled fn1, fn2, fn3 , ...
i want ot loop and use find control but i'm finding them.
i'm using the following w/o luck
ContentPlaceHolder cph =...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |