Hi,
Use the followig code for tablerow
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
namespace PubsPortal.controls.display
{
/// <summary>
/// Summary description for TableRow.
/// </summary>
[DefaultProperty("Text"),
ToolboxData("<{0}:TableRow runat=server></{0}:TableRow>")]
public class TableRow : System.Web.UI.WebControls.TableRow
{
/// <summary>
/// Render this control to the output parameter specified.
/// </summary>
/// <param name="output"The HTML writer to write out to </param>
protected override void Render(HtmlTextWriter output)
{
// debug info
// this.ToolTip = this.Parent.GetType().ToString();
// better way (instead of checking repeateritem) of doing this
// is to check for odd/even control indexes...
// that way tables without repeater
//int RowCount = this.Parent.Controls.Count;
if (this.Parent.GetType().ToString() ==
"System.Web.UI.WebControls.RepeaterItem" )
{
System.Web.UI.WebControls.RepeaterItem parentItem =
(System.Web.UI.WebControls.RepeaterItem)this.Paren t;
if (parentItem.ItemType == ListItemType.AlternatingItem )
{
this.Attributes["bgcolor"]="#f3f9fd";
this.Attributes["height"]="20";
}
}
base.Render(output);
}
/// <summary>
///
/// </summary>
/// <param name="writer"></param>
public override void RenderEndTag(HtmlTextWriter writer)
{
writer.WriteEndTag("tr");
writer.WriteLine();
writer.Indent--;
}
}
}
Ananth Ramasamy Meenachi
Programmer Analyst
"V" wrote:
Hello!
I made custom control with tables and labels in it.
In my page I have several of these controls. Each one should have
different color of tables etc.
I have different SkinIDs for that.
When my Default page loads I'd like to set SkinID for each of these
controls.
I understand that Page_PreInit should have this but I can't access my
control's properties from there.
I also know that control can't have PreInit, only Page.
I spent last ten hours trying to get around this. I don't know what to
do. HELP
Thank you,
Hrvoje