?
Solved

Dynamically applying skins to user controls in asp.net 2.0

Posted on 2009-05-15
3
Medium Priority
?
378 Views
Last Modified: 2012-05-07
How to change the skin of controls in my user control dynamically?
0
Comment
Question by:priyanka_kothari
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 9

Expert Comment

by:tetorvik
ID: 24394336
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
ID: 24394691
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 2000 total points
ID: 24399942
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month8 days, 12 hours left to enroll

764 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