473,671 Members | 2,251 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cusotm Image button and themes

CK
Hello All,
I am trying to extend the default asp:ImageButton to include an image for an
enabled state and a second image for a disabled state. I currently did this
by extending the ImageButton class in a custom control, creating a property
for each of these images (EnabledImageUr l, DisabledImageUr l) and then
overrode the Enabled property to change base.ImageUrl respectively. I am
also trying to use Themes with this web site. The problem is (I can tell by
looking in the page source) that when the image urls are stored in the
custom control they are not being resolved to the actual path of the images
(they are "image\<picName >.gif" in the skin file). Also, when the ImageUrl
is set on the base class it is also not being resolved to the actual (theme)
path. I was wondering if there is something I have to do with my custom
control, some convenience method I can run to resolve these paths or if
there is a specific point in the ASP page lifecycle that I have to plug in
to in order for these paths to get resolved by default.
public class MultiImageButto n : ImageButton
{
private string _enabledImageUr l;
private string _disabledImageU rl;
public bool Enabled
{
get { return base.Enabled; }
set{
base.Enabled = value;
base.ImageUrl = value ? _enabledImageUr l :
_disabledImageU rl;
}
}

public string EnabledImageUrl
{
get { return _enabledImageUr l; }
set{
_enabledImageUr l = value;
if (Enabled)
base.ImageUrl = Page._enabledIm ageUrl;
}
}

public string DisabledImageUr l
{
get
{
return _disabledImageU rl;
}
set
{
_disabledImageU rl = value;
if (!Enabled)
base.ImageUrl = _disabledImageU rl;
}
}
}
Oct 5 '06 #1
2 2450
I did a rollover image that was inherited from the image class. To get the
client side url of the images (and be able to use the ~), which I am
assuming is your issue, use ResolveClientUr l in your RenderControl method
(or in a function you call to help build the HTML output).

return base.ResolveCli entUrl(_swapIma geUrl);
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com/

*************** *************** *************** ****
Think Outside the Box!
*************** *************** *************** ****
"CK" <c_**********@h otmail.comwrote in message
news:VI******** *********@newss vr12.news.prodi gy.com...
Hello All,
I am trying to extend the default asp:ImageButton to include an image for
an enabled state and a second image for a disabled state. I currently did
this by extending the ImageButton class in a custom control, creating a
property for each of these images (EnabledImageUr l, DisabledImageUr l) and
then overrode the Enabled property to change base.ImageUrl respectively.
I am also trying to use Themes with this web site. The problem is (I can
tell by looking in the page source) that when the image urls are stored in
the custom control they are not being resolved to the actual path of the
images (they are "image\<picName >.gif" in the skin file). Also, when the
ImageUrl is set on the base class it is also not being resolved to the
actual (theme) path. I was wondering if there is something I have to do
with my custom control, some convenience method I can run to resolve these
paths or if there is a specific point in the ASP page lifecycle that I
have to plug in to in order for these paths to get resolved by default.
public class MultiImageButto n : ImageButton
{
private string _enabledImageUr l;
private string _disabledImageU rl;
public bool Enabled
{
get { return base.Enabled; }
set{
base.Enabled = value;
base.ImageUrl = value ? _enabledImageUr l :
_disabledImageU rl;
}
}

public string EnabledImageUrl
{
get { return _enabledImageUr l; }
set{
_enabledImageUr l = value;
if (Enabled)
base.ImageUrl = Page._enabledIm ageUrl;
}
}

public string DisabledImageUr l
{
get
{
return _disabledImageU rl;
}
set
{
_disabledImageU rl = value;
if (!Enabled)
base.ImageUrl = _disabledImageU rl;
}
}
}

Oct 6 '06 #2
CK
Thanks for the reply. I did try that before and it didn't work, but it's
good to know what that method is used for. When I used it, the method
returned an absolute path for the website based on the location of the page
containing the control. My problem is that the theme information is located
at \\WebSite\App_T hemes\MyTheme\ with the images for that theme located at
\\WebSite\App_T hemes\MyTheme\I mages and most of the pages of my site have a
path similar to \\WebSite\MyWeb Page.aspx. All of the other skin information
for traditional asp controls contains properties like ImageUrl="image s\mypic.gif"
and they work correctly. Using Reflector, I was able to determine that, at
some point, the page itself iterates through its controls and applies skin
information, which I'm assuming also includes adjusting the paths to any
skin information to absolute paths. For some reason, the paths on this
custom control and its parent are not being adjusted to include the skin
path (when I view the source of the page, the image src for the custom
control is still "images\mypic.g if" where all of the other paths have been
changed to "App_Themes\MyT heme\images\myp ic.gif").
I'm thinking there has to be some type of attribute I am missing or some
type of method I need to implement to get this custom control to be included
when the page is adjusting the paths for the skin information

TIA
~CK

"Cowboy (Gregory A. Beamer)" <No************ @comcast.netNoS pamMwrote in
message news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>I did a rollover image that was inherited from the image class. To get the
client side url of the images (and be able to use the ~), which I am
assuming is your issue, use ResolveClientUr l in your RenderControl method
(or in a function you call to help build the HTML output).

return base.ResolveCli entUrl(_swapIma geUrl);
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com/

*************** *************** *************** ****
Think Outside the Box!
*************** *************** *************** ****
"CK" <c_**********@h otmail.comwrote in message
news:VI******** *********@newss vr12.news.prodi gy.com...
>Hello All,
I am trying to extend the default asp:ImageButton to include an image for
an enabled state and a second image for a disabled state. I currently
did this by extending the ImageButton class in a custom control, creating
a property for each of these images (EnabledImageUr l, DisabledImageUr l)
and then overrode the Enabled property to change base.ImageUrl
respectively . I am also trying to use Themes with this web site. The
problem is (I can tell by looking in the page source) that when the image
urls are stored in the custom control they are not being resolved to the
actual path of the images (they are "image\<picName >.gif" in the skin
file). Also, when the ImageUrl is set on the base class it is also not
being resolved to the actual (theme) path. I was wondering if there is
something I have to do with my custom control, some convenience method I
can run to resolve these paths or if there is a specific point in the ASP
page lifecycle that I have to plug in to in order for these paths to get
resolved by default.
public class MultiImageButto n : ImageButton
{
private string _enabledImageUr l;
private string _disabledImageU rl;
public bool Enabled
{
get { return base.Enabled; }
set{
base.Enabled = value;
base.ImageUrl = value ? _enabledImageUr l :
_disabledImage Url;
}
}

public string EnabledImageUrl
{
get { return _enabledImageUr l; }
set{
_enabledImageUr l = value;
if (Enabled)
base.ImageUrl = Page._enabledIm ageUrl;
}
}

public string DisabledImageUr l
{
get
{
return _disabledImageU rl;
}
set
{
_disabledImageU rl = value;
if (!Enabled)
base.ImageUrl = _disabledImageU rl;
}
}
}


Oct 6 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2475
by: Peter | last post by:
Can Anybody tell me why my toolbar button's image is missing when my app is run, While the image is well enough in design time ?
4
1677
by: Sean | last post by:
My experience now working with master pages on and off for 6 months is that they can be very dangerous when working with themes. One example in particular is the changes I made to my banner menu which now work just fine with all my themes on my development machine but on my production server my non-standard themes are showing effects that are no longer in place even with a complete re-copy of my project. Problems like this with...
6
2488
by: Clinton Farleigh | last post by:
Hi, I was going to ask a question, but I think I've answered it so now I am going to rant about how crappy ASP.NET themes are instead. As I've indicated above, my problem today is with themes. Per microsoft "Only one theme can be applied to each page. You cannot apply multiple themes to a page, unlike style sheets where multiple style sheets can be applied."
3
2568
by: WT | last post by:
Hello, I need to list all available themes for a .NET app, is there any API in ..NET2 for this or should I explore the folder files using IO methods ? Thanks for indication CS
11
6610
by: New Bee | last post by:
Hi, I have been looking at Themes and Skins today and now resonably understand how they work at a ground level. But I have a couple of questions. 1. ) StyleSheetTheme I dont understand where this would be used. As I understand it the precidence is like this.
0
1122
by: moni.aggarwal | last post by:
-------------------------------------------------------------------------------- Hi I have made a httpmodule to control my themes.I have an image in my skin file of my apptheme folder. But the url of image is not working. But when I handle my themes without httpmodule image url is working... Can Any one help me in finding out why image url is not working.
1
19663
by: swc76801 | last post by:
I desperately need help. My understanding of CSS is non-existent. I have a store http://astore.amazon.com/texasheat-20 with Amazon.com. According to the information from Amazon.com "Write your own overriding CSS to customize your aStore." Their setup page is divided into two sections. On the right they show the existing CSS. On the left there is a box where you can add the new code. They have tabs for "Global", "Category Page", "Detail Page",...
11
3004
by: Evolution445 | last post by:
I got this code, and it somehow doesnt work. <TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0 align="center"> <TR> <TD background="{image-path}navfiller.gif" HEIGHT=40 width="50%"></TD> <TD width="110"><a href="index.php"><IMG SRC="{image-path}matrix_03.gif" WIDTH=110 HEIGHT=40 ALT="Homepage" border="0" onmouseover="myOn('matrix_03')" onmouseout="myOut('matrix_03')"></a></TD> <TD width="100"><a...
17
10330
by: govolsbaby | last post by:
Is there a way to leave the button forecolor unchanged when it is disabled? I have multiple buttons on the form and depending on various user inputs, some will or will not be enabled but I'd rather their text not go to gray. Thanks.
0
8476
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8821
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
7437
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...
0
5696
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4407
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2812
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
2
2051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1809
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.