473,396 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

What's the server control equivalent of <input type="image"> ?

Hello,

I have a page which I am converting to use themes. The page has an HTML
<input type="image"> element that is used to post to another page. I
would like to replace this with a server control so I can add a skinid.

I tried adding runat="server" and the skinid to the existing control,
but that didn't work. Any other ideas? TIA

--
Alan Silver
(anything added below this line is nothing to do with me)
Jan 10 '06 #1
17 3157
Use a System.Web.UI.HtmlControls.HtmlImage Control.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Alan Silver" <al*********@nospam.thanx> wrote in message
news:FR**************@nospamthankyou.spam...
Hello,

I have a page which I am converting to use themes. The page has an HTML
<input type="image"> element that is used to post to another page. I would
like to replace this with a server control so I can add a skinid.

I tried adding runat="server" and the skinid to the existing control, but
that didn't work. Any other ideas? TIA

--
Alan Silver
(anything added below this line is nothing to do with me)

Jan 10 '06 #2
>Use a System.Web.UI.HtmlControls.HtmlImage Control.

Isn't that just a plain <img> tag? I want an <input type="image"> tag.
Nothing will happen if you click an HtmlImage control (will it?)

Looking at the SDK, it seems that the following should work...

<input type="image" SkinID="imgBasket" runat="server" />

where the skin file contains...

<asp:ImageButton skinid="imgBasket" imageurl="images/basket.gif"
width="119" height="20" runat="server" />

however, that produces the following HTML...

<input name="ctl00$cphMainBody$ctl00$ctl01" type="image" />

As you can see, no src attribute, and no width or height.

Any ideas? Thanks for the reply.

--
Alan Silver
(anything added below this line is nothing to do with me)
Jan 10 '06 #3
I would think...an ImageButton. But I haven't tried it...

Alan Silver wrote:
Hello,

I have a page which I am converting to use themes. The page has an HTML
<input type="image"> element that is used to post to another page. I
would like to replace this with a server control so I can add a skinid.

I tried adding runat="server" and the skinid to the existing control,
but that didn't work. Any other ideas? TIA

--
Alan Silver
(anything added below this line is nothing to do with me)


Jan 10 '06 #4
Hi Alan,

Sorry, yes, the ImageButton is what yuo want, to submit the form. I'm not
sure what is wrong with your use of the "SkinID" attribute. I know that it
is not an HTML attribute, and perhaps ASP.Net checks it. I've never tried to
add a non-standard attribute to an ASP.Net Control. You might try using the
AddAttributes() method of the Control to add it.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Alan Silver" <al*********@nospam.thanx> wrote in message
news:qj**************@nospamthankyou.spam...
Use a System.Web.UI.HtmlControls.HtmlImage Control.


Isn't that just a plain <img> tag? I want an <input type="image"> tag.
Nothing will happen if you click an HtmlImage control (will it?)

Looking at the SDK, it seems that the following should work...

<input type="image" SkinID="imgBasket" runat="server" />

where the skin file contains...

<asp:ImageButton skinid="imgBasket" imageurl="images/basket.gif"
width="119" height="20" runat="server" />

however, that produces the following HTML...

<input name="ctl00$cphMainBody$ctl00$ctl01" type="image" />

As you can see, no src attribute, and no width or height.

Any ideas? Thanks for the reply.

--
Alan Silver
(anything added below this line is nothing to do with me)

Jan 10 '06 #5
>Hi Alan,

Sorry, yes, the ImageButton is what yuo want, to submit the form. I'm not
sure what is wrong with your use of the "SkinID" attribute. I know that it
is not an HTML attribute, and perhaps ASP.Net checks it. I've never tried to
add a non-standard attribute to an ASP.Net Control. You might try using the
AddAttributes() method of the Control to add it.


According to the SDK, SkinID is an attribute of the HTML control, so
should be used by the framework. That's why I'm confused why it didn't
work.

Any ideas? Thanks

--
Alan Silver
(anything added below this line is nothing to do with me)
Jan 11 '06 #6
>I would think...an ImageButton. But I haven't tried it...

I have, and I couldn't get it to work, hence my post ;-)

Thanks anyway
Alan Silver wrote:
Hello,

I have a page which I am converting to use themes. The page has an HTML
<input type="image"> element that is used to post to another page. I
would like to replace this with a server control so I can add a skinid.

I tried adding runat="server" and the skinid to the existing control,
but that didn't work. Any other ideas? TIA

--
Alan Silver
(anything added below this line is nothing to do with me)


--
Alan Silver
(anything added below this line is nothing to do with me)
Jan 11 '06 #7
Hi Alan,

Yes, you're right. I have never used this attribute, so I was unfamiliar
with it. I believe your problem can be solved by assigning an ID attribute
to the Control.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Alan Silver" <al*********@nospam.thanx.invalid> wrote in message
news:vo**************@nospamthankyou.spam...
Hi Alan,

Sorry, yes, the ImageButton is what yuo want, to submit the form. I'm not
sure what is wrong with your use of the "SkinID" attribute. I know that it
is not an HTML attribute, and perhaps ASP.Net checks it. I've never tried
to
add a non-standard attribute to an ASP.Net Control. You might try using
the
AddAttributes() method of the Control to add it.


According to the SDK, SkinID is an attribute of the HTML control, so
should be used by the framework. That's why I'm confused why it didn't
work.

Any ideas? Thanks

--
Alan Silver
(anything added below this line is nothing to do with me)

Jan 11 '06 #8
>Hi Alan,

Yes, you're right. I have never used this attribute, so I was unfamiliar
with it. I believe your problem can be solved by assigning an ID attribute
to the Control.


Thanks for the reply, however it didn't work ;-)

I changed the server tag to look like...

<input id="inpAddToBasket" type="image" SkinID="imgBasket"
runat="server" />

and this produced the following HTML...

<input name="ctl00$cphMainBody$ctl00$inpAddToBasket" type="image"
id="ctl00_cphMainBody_ctl00_inpAddToBasket" />

As you can see, the src attribute has not been set.

Any other ideas? I'm a bit stuck here as I think I'm doing exactly what
the SDK says you should be able to do, but it isn't working.

Thanks again

--
Alan Silver
(anything added below this line is nothing to do with me)
Jan 11 '06 #9
>Hello,

OK, I found the source of my problem...

My skin file contains a definition for an ImageButton, but the control
I'm using *isn't* one of those, it's an <input type="image"> control,
which is an HTML control. ImageButton is a web server control, not an
HTML control.

The problem is that it seems you can't skin HTML controls!! You look in
the SDK, and you see that they have a SkinID property, you look in the
info on skinning and you don't see any disclaimer telling you that you
can't skin an HTML control, but if you try adding the following to your
skin file...

<input type="image" skinid="imgBasket" src="images/basket.gif"
width="119" height="20" runat="server" />

.... you get a parser error "The control type
'System.Web.UI.HtmlControls.HtmlInputImage' cannot be themed" when you
try and run the page.

So either I'm doing something wrong and there's another way of applying
a skin to an HTML control, or there's a hole in the framework
functionality that is emphasised by an apparently useless property
(SkinID).

I would point out that HTML controls also have an EnableTheming
property, which does imply that they can be skinned, but I can't find
out how to do it.

Anyone any idea about this?

--
Alan Silver
(anything added below this line is nothing to do with me)
Jan 11 '06 #10
Hi Alan,

Well, thanks to you I've been finding out all about Themes. :-)

I have not learned everything, but hopefully enough to keep you going.

HtmlControls all inherit System.Web.UI.Control, which has a SkinID property
and an EnableTheming property. However, not all System.Web.UI.Controls are
themeable. There is an attribute called ThemeableAttribute, which, if set to
false, disables theming for a Control, regardless of these 2 properties.

The difficult part for me is finding out what Controls are themeable and
what Controls are not. You can't view attributes in the .Net SDK. They are
not documented (unfortunately). You can view them in Ildasm.exe, but it's
like looking for a needle in a haystack. I tried using the JungleCreatures
..Net decompiler, but it doesn't support version 2.0. Apparently, an
HtmlInputImage Control is not themeable. I searched the WWW for some sort of
list, but came up empty. It seems for now your only alternative is to do
what you've been doing in order to find out.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Alan Silver" <al*********@nospam.thanx.invalid> wrote in message
news:71**************@nospamthankyou.spam...
Hello,


OK, I found the source of my problem...

My skin file contains a definition for an ImageButton, but the control I'm
using *isn't* one of those, it's an <input type="image"> control, which is
an HTML control. ImageButton is a web server control, not an HTML control.

The problem is that it seems you can't skin HTML controls!! You look in
the SDK, and you see that they have a SkinID property, you look in the
info on skinning and you don't see any disclaimer telling you that you
can't skin an HTML control, but if you try adding the following to your
skin file...

<input type="image" skinid="imgBasket" src="images/basket.gif" width="119"
height="20" runat="server" />

... you get a parser error "The control type
'System.Web.UI.HtmlControls.HtmlInputImage' cannot be themed" when you try
and run the page.

So either I'm doing something wrong and there's another way of applying a
skin to an HTML control, or there's a hole in the framework functionality
that is emphasised by an apparently useless property (SkinID).

I would point out that HTML controls also have an EnableTheming property,
which does imply that they can be skinned, but I can't find out how to do
it.

Anyone any idea about this?

--
Alan Silver
(anything added below this line is nothing to do with me)

Jan 11 '06 #11
>Hi Alan,

Hello
Well, thanks to you I've been finding out all about Themes. :-)
Oh well, at least one of us has benefited from this ;-)

Themes are good aren't they?
I have not learned everything, but hopefully enough to keep you going.
Oh well, that makes two of us!!
HtmlControls all inherit System.Web.UI.Control, which has a SkinID property
and an EnableTheming property. However, not all System.Web.UI.Controls are
themeable. There is an attribute called ThemeableAttribute, which, if set to
false, disables theming for a Control, regardless of these 2 properties.
Yeah, but it's true by default, so that's a bit of a red herring.
The difficult part for me is finding out what Controls are themeable and
what Controls are not. You can't view attributes in the .Net SDK. They are
not documented (unfortunately). You can view them in Ildasm.exe, but it's
like looking for a needle in a haystack. I tried using the JungleCreatures
.Net decompiler, but it doesn't support version 2.0. Apparently, an
HtmlInputImage Control is not themeable. I searched the WWW for some sort of
list, but came up empty.
Me too. I can't understand why this isn't documented. Having the
EnableThemeing and SkinID properties implies they can be themed, and I
couldn't find any docs to say otherwise. You don't even get an error,
just a lack of theming. Sounds like an oversight on MS's part if you ask
me. They should have done this a bit better.
It seems for now your only alternative is to do
what you've been doing in order to find out.


At the moment I am contemplating rewriting some code to avoid using the
<input> tag. This feels wrong, but I can't see any other way around it.
Now that 2.0 supports cross-page posting, I should be able to do what I
want with server controls, but that means rewriting, retesting, etc. I
was right on the point of deploying the site as well. Ho hum.

Thanks anyway. If you find out anything more, please report back.

--
Alan Silver
(anything added below this line is nothing to do with me)
Jan 11 '06 #12
Hi Alan,

With the advent of aspect-oriented programming, and Microsoft's upcoming
"Windows Communication Foundation" ("Indigo")product, which uses
aspect-oriented programming, and therefore, attributes quite a bit, I think
MS will have to re-examine how they document their .Net classes. If you're
going to make extensive use of attributes, it makes sense to document them,
and how they affect behavior.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Alan Silver" <al*********@nospam.thanx.invalid> wrote in message
news:mp**************@nospamthankyou.spam...
Hi Alan,


Hello
Well, thanks to you I've been finding out all about Themes. :-)


Oh well, at least one of us has benefited from this ;-)

Themes are good aren't they?
I have not learned everything, but hopefully enough to keep you going.


Oh well, that makes two of us!!
HtmlControls all inherit System.Web.UI.Control, which has a SkinID
property
and an EnableTheming property. However, not all System.Web.UI.Controls are
themeable. There is an attribute called ThemeableAttribute, which, if set
to
false, disables theming for a Control, regardless of these 2 properties.


Yeah, but it's true by default, so that's a bit of a red herring.
The difficult part for me is finding out what Controls are themeable and
what Controls are not. You can't view attributes in the .Net SDK. They are
not documented (unfortunately). You can view them in Ildasm.exe, but it's
like looking for a needle in a haystack. I tried using the JungleCreatures
.Net decompiler, but it doesn't support version 2.0. Apparently, an
HtmlInputImage Control is not themeable. I searched the WWW for some sort
of
list, but came up empty.


Me too. I can't understand why this isn't documented. Having the
EnableThemeing and SkinID properties implies they can be themed, and I
couldn't find any docs to say otherwise. You don't even get an error, just
a lack of theming. Sounds like an oversight on MS's part if you ask me.
They should have done this a bit better.
It seems for now your only alternative is to do
what you've been doing in order to find out.


At the moment I am contemplating rewriting some code to avoid using the
<input> tag. This feels wrong, but I can't see any other way around it.
Now that 2.0 supports cross-page posting, I should be able to do what I
want with server controls, but that means rewriting, retesting, etc. I was
right on the point of deploying the site as well. Ho hum.

Thanks anyway. If you find out anything more, please report back.

--
Alan Silver
(anything added below this line is nothing to do with me)

Jan 12 '06 #13
>Hi Alan,

With the advent of aspect-oriented programming, and Microsoft's upcoming
"Windows Communication Foundation" ("Indigo")product, which uses
aspect-oriented programming, and therefore, attributes quite a bit, I think
MS will have to re-examine how they document their .Net classes. If you're
going to make extensive use of attributes, it makes sense to document them,
and how they affect behavior.


Unfortunately, my web site can't wait that long!!

It would have been nice if they'd got the documentation clear at this
stage!!

Ta ra

--
Alan Silver
(anything added below this line is nothing to do with me)
Jan 12 '06 #14

Kevin Spencer wrote:
I tried using the JungleCreatures
.Net decompiler, but it doesn't support version 2.0. Apparently, an
HtmlInputImage Control is not themeable.


Hi Kevin,

We do have a 2.0 version of our Decompiler.NET product available on our
web site that decompiles 2.0 and 1.1 assemblies. Licensed customers can
use their licenses with either the 1.1 and 2.0 versions. We also
provide a free version to MSDN subscribers that decompiles .NET
Framework assemblies 100% in the browser UI. You can download the 2.0
version of the product from the 2.0 link on the products page on our
web site at:
http://www.junglecreatures.com/Deskt...ndex=3&tabid=3

Jonathan Pierce
President
Jungle Creatures, Inc.
http://www.junglecreatures.com/

Jan 14 '06 #15
Thanks Jonathan. I will look into it. You have an excellent product there!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

<jp*****@nyc.rr.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...

Kevin Spencer wrote:
I tried using the JungleCreatures
.Net decompiler, but it doesn't support version 2.0. Apparently, an
HtmlInputImage Control is not themeable.


Hi Kevin,

We do have a 2.0 version of our Decompiler.NET product available on our
web site that decompiles 2.0 and 1.1 assemblies. Licensed customers can
use their licenses with either the 1.1 and 2.0 versions. We also
provide a free version to MSDN subscribers that decompiles .NET
Framework assemblies 100% in the browser UI. You can download the 2.0
version of the product from the 2.0 link on the products page on our
web site at:
http://www.junglecreatures.com/Deskt...ndex=3&tabid=3

Jonathan Pierce
President
Jungle Creatures, Inc.
http://www.junglecreatures.com/

Jan 14 '06 #16
>Apparently, an HtmlInputImage Control is not themeable. I searched the
WWW for some sort of list, but came up empty. It seems for now your
only alternative is to do what you've been doing in order to find out.


ASP.NET is just brilliant!!

I was working on another site his morning, and came across my first need
to do cross-page posting. This was so easy that I'm going to redo the
above-mentioned code with a cross-page post, removing the need for an
HtmlInputImage control. I can just use a normal server control and set
the PostBackUrl property.

Just thought I'd post this up for the benefit of anyone reading this
later. No you can't theme the HtmlInputImage, but it's very possible you
won't need to as cross-page posting is really easy.

I'm still excited about it ;-) Childish really!!

Ta ra

--
Alan Silver
(anything added below this line is nothing to do with me)
Jan 16 '06 #17
Good stuff, Alan! I was unaware of this new feature, and looked it up.
Thanks for sharing what you learned!

--

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Alan Silver" <al*********@nospam.thanx.invalid> wrote in message
news:tj**************@nospamthankyou.spam...
Apparently, an HtmlInputImage Control is not themeable. I searched the
WWW for some sort of list, but came up empty. It seems for now your only
alternative is to do what you've been doing in order to find out.


ASP.NET is just brilliant!!

I was working on another site his morning, and came across my first need
to do cross-page posting. This was so easy that I'm going to redo the
above-mentioned code with a cross-page post, removing the need for an
HtmlInputImage control. I can just use a normal server control and set the
PostBackUrl property.

Just thought I'd post this up for the benefit of anyone reading this
later. No you can't theme the HtmlInputImage, but it's very possible you
won't need to as cross-page posting is really easy.

I'm still excited about it ;-) Childish really!!

Ta ra

--
Alan Silver
(anything added below this line is nothing to do with me)

Jan 16 '06 #18

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

Similar topics

14
by: Gregory | last post by:
Hello, I'm trying to do the above in order to process an image and return the result to an html image control. It fails and my key suspects are either the variable that I'm passing in -...
8
by: Eric Bragas | last post by:
What is this? <img src="{$ ImagesDir}/photo.gif"> I KNOW what an HTML image tag looks like. But what do you call that in the file source? Is it like a virtual directory in IIS? It's some type...
5
by: Mikko Rantalainen | last post by:
See example at <URL:http://www.cc.jyu.fi/~mira/moz/formtest.php>. The problem is that the label of submit button is always centered on the button regardsless of 'text-align' property in CSS....
1
by: Mark Sandfox | last post by:
Is there a way to restrict the user to only selecting and sending either a ..gif or .jpg. Everything I have read says this option can not be done by design (security reasons). I find that irronic...
2
by: Alan Silver | last post by:
Hello, If I have the following HTML... <input type="image" src="fred.gif"> .... is there a way to specify the image in CSS rather than in the HTML? TIA
3
by: =?Utf-8?B?V2lsbA==?= | last post by:
I have an image "button" which causes a postback. I handle the "click" with If Request.Form("btnBU7WD6_Submit.X") 0 Then... this works great. However, when a user double-clicks the image...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.