Solved

Dynamically applying skins to user controls in asp.net 2.0

Posted on 2009-05-15
3
373 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 500 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

687 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