sethUSer420
asked on
accessing the class parameter of a HtmlTable
it's easy to manipulate the style param of a <td> within .net you just:
dividerCol1.Style.Clear();
dividerCol1.Style.Add("bac kground-co lor","#CCC CCC");
or whatever
is there easy access to the css class param of a <td>? like <td class="backColor"> or do I have to go through the attributes property?
dividerCol1.Style.Clear();
dividerCol1.Style.Add("bac
or whatever
is there easy access to the css class param of a <td>? like <td class="backColor"> or do I have to go through the attributes property?
Can you not just use dividerCol1.CssClass?
Sorry, that was not meant to be flippant. I have been setting class attributes of various objects (including <tr> and <td>) using the cssclass property, admittedly that was through a datagrid.
Andy
Andy
ASKER
'System.Web.UI.HtmlControl s.HtmlTabl eCell' does not contain a definition for 'CssClass'
haha, I knew there would be a problem like that.
Andy
Andy
ASKER
haha
then dont waste my time with it
then dont waste my time with it
For an HtmlControl run at the server, use
Dim tblc As System.Web.UI.HtmlControls .HtmlTable Cell
Dim tblr As System.Web.UI.HtmlControls .HtmlTable Row
For Each tblr In Me.Table1.Rows
tblr.Attributes.Add("class ", "Row Class")
For Each tblc In tblr.Cells
tblc.Attributes.Add("class ", "Cell Class")
Next
Next
Dim tblc As System.Web.UI.HtmlControls
Dim tblr As System.Web.UI.HtmlControls
For Each tblr In Me.Table1.Rows
tblr.Attributes.Add("class
For Each tblc In tblr.Cells
tblc.Attributes.Add("class
Next
Next
or in c#, which your question was in
foreach (HtmlTableRow tblr in this.Table1.Rows)
{
tblr.Attributes.Add("class ", "row class");
foreach (HtmlTableCell tblc in tblr.Cells)
{
tblc.Attributes.Add("class ", "cell class");
}
}
foreach (HtmlTableRow tblr in this.Table1.Rows)
{
tblr.Attributes.Add("class
foreach (HtmlTableCell tblc in tblr.Cells)
{
tblc.Attributes.Add("class
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.