469,292 Members | 1,310 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,292 developers. It's quick & easy.

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 2931
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Mikko Rantalainen | last post: by
3 posts views Thread by =?Utf-8?B?V2lsbA==?= | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.