473,608 Members | 2,565 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3318
Hi,

Use the followig code for tablerow

using System;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Componen tModel;

namespace PubsPortal.cont rols.display
{
/// <summary>
/// Summary description for TableRow.
/// </summary>
[DefaultProperty ("Text"),
ToolboxData("<{ 0}:TableRow runat=server></{0}:TableRow>")]
public class TableRow : System.Web.UI.W ebControls.Tabl eRow
{
/// <summary>
/// Render this control to the output parameter specified.
/// </summary>
/// <param name="output"Th e HTML writer to write out to </param>
protected override void Render(HtmlText Writer output)
{
// debug info
// this.ToolTip = this.Parent.Get Type().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.Con trols.Count;

if (this.Parent.Ge tType().ToStrin g() ==
"System.Web.UI. WebControls.Rep eaterItem" )
{
System.Web.UI.W ebControls.Repe aterItem parentItem =
(System.Web.UI. WebControls.Rep eaterItem)this. Parent;

if (parentItem.Ite mType == ListItemType.Al ternatingItem )
{
this.Attributes["bgcolor"]="#f3f9fd";
this.Attributes["height"]="20";
}
}
base.Render(out put);
}

/// <summary>
///
/// </summary>
/// <param name="writer"></param>
public override void RenderEndTag(Ht mlTextWriter writer)
{
writer.WriteEnd Tag("tr");
writer.WriteLin e();
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
4144
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 want all of the controls in whatever is the CURRENT record to have it's data bolded on the screen. (Question #1: Is there a SIMPLE way to refer to the Current Record?) I've been trying to use a Bookmark to specify the current record, but it
0
1165
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 converting to ASP.NET 2.0, I'm using the Menu control provided within the framework. Everything is working well except for changing window status. In the classic ASP app I use a onLoad in the Page tag the sets window.status="Whatever". Then when...
2
2577
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 good while and I'm getting really frustrated now! My problem is this - my custom controls periodically disappear from my
1
8238
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 buttons on a Control that I was hoping I could use to switch the SkinID, but it appears it's not that easy to do during runtime. Here is the code I tried to use protected void imgBtnDefaultColour_Click(object sender,
0
1068
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. 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
15
6504
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 accept other controls. The control i drag drop on it becomes the child of my custom control's parent form and not the child of my custom control. Then i added this line "" before my custom control class (i dont know what this line does). Now
2
2132
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 ascx page. I checked with traces that the skinid is correctlyset, theApp_Theme folder contains the correct Theme whichcontains the Skin, and this last file contain correct path to the gif image placed in a folder under the currenttheme.
14
2007
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 not traceable exception triggered and the all binding is stopped. But this same named skinid is working for hyperlinks outside templates.
0
1697
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. What I'm trying to achieve is to make this "theme able", so I could set different styles for title and simple rows. Problem is that you can't change SkinId of control that already added to controls collection after page init and I can populate dataset...
0
7998
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8470
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8329
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6813
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6010
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4022
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2472
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1580
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1327
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.