Solved

Dynamically applying skins to user controls in asp.net 2.0

Posted on 2009-05-15
3
336 Views
Last Modified: 2012-05-07
How to change the skin of controls in my user control dynamically?
0
Comment
Question by:priyanka_kothari
  • 2
3 Comments
 
LVL 9

Expert Comment

by:tetorvik
Comment Utility
you'll need to do it in Page_PreInit event like:
*.ascx.cs   

    void Page_PreInit(object sender, EventArgs e)

    {

        Calendar1.SkinID = "MySkin";

    } 

Open in new window

0
 

Author Comment

by:priyanka_kothari
Comment Utility
I have done the same but its not working. I am using login control and want to change skin of login controls' controls
0
 
LVL 9

Accepted Solution

by:
tetorvik earned 500 total points
Comment Utility
I have to admit i haven't been playing around with login control too much. But quickly looking at it, I managed to change control appearance by applying skinid dynamically. This is what I did:

1:converted the login control to template (http://msdn.microsoft.com/en-us/library/ms178340.aspx) to see what control ids the controls in login control have. (you can also do this without converstion, but then you'll need to find another way around to find the controls you're intrested)
2:on Page_PreInit :
   this.Login1.FindControl("UserNameLabel").SkinID = "mySkin";
3: remember to have the theme set up correctly on your page
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now