Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > SkinID not working for images

Reply
Thread Tools

SkinID not working for images

 
 
WT
Guest
Posts: n/a
 
      02-05-2007
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.
But no image displayed, looking to the generated source I find <img src=""
......> ?
Is thisa known problem ?
Any help welcome.

CS


 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
Guest
Posts: n/a
 
      02-05-2007
Howdy,

I think you haven't set Theme attribute of the page. I copied working
example for you:
-- begin aspx code --
<%@ Page Language="C#" EnableViewState="true" AutoEventWireup="true"
CodeFile="HelloWorld.aspx.cs" Inherits="HelloWorld"
Theme="Red" %>

<html>
<head runat="server">
<title></title>
</head>
<body>
<form id="Form1" runat="server">

<script runat="server">
protected void Page_Init(object source, EventArgs e)
{
Image image = new Image();

image.ID = "img1";
image.SkinID = "red";

myAnchor.Controls.Add(image);

}
</script>

<a href="#" runat="server" id="myAnchor"></a>

</form>
</body>
</html>
-- end aspx code --

-- begin skin file --

<asp:Image runat="server" ImageUrl="~/1.jpg" SkinID="red"/>

-- end skin file --

Skin file is put under App_Themes\Red\RedSkin.skin folder

--
Milosz


"WT" wrote:

> 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.
> But no image displayed, looking to the generated source I find <img src=""
> ......> ?
> Is thisa known problem ?
> Any help welcome.
>
> CS
>
>
>

 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      02-06-2007
Thanks for Milosz's input.

Hi CS,

As Milosz suggested, you can first check the page's Theme setting to see
whether the Theme has been applied to the page(in the page directive). Or
if you want to programmatically apply Theme for your web page, you can use
Page.PreInit event to do it. e.g.

void Page_PreInit(object sender, EventArgs e)
{
Page.Theme = "themename";
}

Here is good article which has described creating and apply Theme for
ASP.NET 2.0 page

#Creating Web Application Themes in ASP.NET 2.0
http://msdn2.microsoft.com/en-us/lib...#themes_topic8

Please feel free to post here if you have any further questions on this.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change a controls SkinID at runtime (asp.net 2.0) stephen.mcallister@gmail.com ASP .Net 2 04-12-2008 10:22 AM
Programmatically Set SkinId Properties For Controls Within UpdatePanel? Joey ASP .Net 0 10-24-2007 08:55 PM
Pb with skinID in templated columns having DataBinder.Eval WT ASP .Net 14 06-21-2007 08:19 AM
Changing skinId on custom control HELP! V ASP .Net 0 11-04-2006 04:20 PM
SkinId shapper ASP .Net 0 09-22-2006 10:28 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57