473,395 Members | 1,473 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,395 software developers and data experts.

Changing skinId on custom ASP.net control HELP!

V
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

Nov 6 '06 #1
1 3306
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

Nov 6 '06 #2

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

Similar topics

4
by: DBQueen | last post by:
I have a subform which is in Continuous Forms view. I have added a button to the bottom of the page to move to the next record using the button wizard (result: DoCmd.GoToRecord , , acNext). I...
0
by: Sydem | last post by:
I have a classic ASP site that I'm converting to ASP.NET 2.0 using VS 2005 Beta 2 with the VB.NET language. In my classic ASP web app I use a custom Javascript that creates a menu "control". In...
2
by: Suzanne | last post by:
Hi all, I'm reposting this message as I'm experiencing this problem more and more frequently : I really hope someone out there can help me as I've been tearing my hair out on this one for a...
1
by: stephen.mcallister | last post by:
I am toying around with Personalization in asp.net 2.0 and would like my users to be able to choose a SkinID at runtime. I have a theme with a default gridview skin and a custom skin. There are 2...
0
by: V | last post by:
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....
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
2
by: WT | last post by:
Hello, In my code I set the SkindId for image objects before the Page_Load event for the page. The image is created then added to the control list of an HtmlAnchor object already present in the...
14
by: WT | last post by:
Hello, I have a usercontrol loaded in a page with a theme. This usercontrol contains columns template with hyperlinks, with skinID. The columns are not displayed, seems thta there is some...
0
jenka1980
by: jenka1980 | last post by:
What is the best way to correspond SkinId in GridView to the data which bound to it ? I have dataset which I bound to a GridView. Dataset contains a table where part of rows are title rows....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.