Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How do I emulate a LinkButton with this HTML clickable image?

Reply
Thread Tools

How do I emulate a LinkButton with this HTML clickable image?

 
 
mark4asp
Guest
Posts: n/a
 
      10-19-2007
How do I emulate a LinkButton with this HTML clickable image?

I have been using a LinkButton with an OnCommand event (it has a
background image repeated). I want to replace the LinkButton with bit
of html which looks like an image button but has the text as html -
this uses two images (a matching left and right image) so that it has
pretty rounded corners. PS: this is the kind of thing which is
typically done when making css tabbed menus.

My html looks like this:

<div class="Button" id="btnReset"><a class="aButton"
href="javascript:Clear();" title="Refresh"><span
class="sButton">Refresh</span></a></div>

The button displays fine and the two images look like a seamless
whole. The point of this being that I can use any word apart from
"Refresh" and the images will size themselves in the background to
wrap the text nicely. The <a> element has the LHS part of the button
and the sButton class references the RHS of the button.

How do I fire a server side event from that "javascript:Clear();"?

There is a matching button to this as well with a
href="javascript:Search();"

I have thought of storing a suitable value in a hidden form variable.
Can I then submit the asp.net form from javascript?, and then select
the server-side to execute depending on the value of the form variable
(seems a pretty ugly way of doing things to me). What is the 'correct'
way of doing this?

I have no intention of making a user control as it would be more
productive to ajaxify the page but, right now, I prefer something
quick.

 
Reply With Quote
 
 
 
 
Nick Chan
Guest
Posts: n/a
 
      10-19-2007
<input type="hidden" value="0" name="Clicked"/>

<div class="Button" id="btnReset"><a class="aButton"
href="javascript:Clear();document.forms[0].Clicked=1;document.forms[0].submit()"
title="Refresh"><span
class="sButton">Refresh</span></a></div>



sub PageLoad

if Request.Form("Clicked") = "1" then

' code here

end if



On Oct 19, 2:20 pm, mark4asp <mark4...@gmail.com> wrote:
> How do I emulate a LinkButton with this HTML clickable image?
>
> I have been using a LinkButton with an OnCommand event (it has a
> background image repeated). I want to replace the LinkButton with bit
> of html which looks like an image button but has the text as html -
> this uses two images (a matching left and right image) so that it has
> pretty rounded corners. PS: this is the kind of thing which is
> typically done when making css tabbed menus.
>
> My html looks like this:
>
> <div class="Button" id="btnReset"><a class="aButton"
> href="javascript:Clear();" title="Refresh"><span
> class="sButton">Refresh</span></a></div>
>
> The button displays fine and the two images look like a seamless
> whole. The point of this being that I can use any word apart from
> "Refresh" and the images will size themselves in the background to
> wrap the text nicely. The <a> element has the LHS part of the button
> and the sButton class references the RHS of the button.
>
> How do I fire a server side event from that "javascript:Clear();"?
>
> There is a matching button to this as well with a
> href="javascript:Search();"
>
> I have thought of storing a suitable value in a hidden form variable.
> Can I then submit the asp.net form from javascript?, and then select
> the server-side to execute depending on the value of the form variable
> (seems a pretty ugly way of doing things to me). What is the 'correct'
> way of doing this?
>
> I have no intention of making a user control as it would be more
> productive to ajaxify the page but, right now, I prefer something
> quick.



 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      10-19-2007
the best approach is to create a usercontrol, implement
IPostBackEventHandler and change the href to:

string href="javascript:Clear();" +
Page.ClientScript.GetPostBackEventReference(postba ckOptions);


-- bruce (sqlwork.com)

mark4asp wrote:
> How do I emulate a LinkButton with this HTML clickable image?
>
> I have been using a LinkButton with an OnCommand event (it has a
> background image repeated). I want to replace the LinkButton with bit
> of html which looks like an image button but has the text as html -
> this uses two images (a matching left and right image) so that it has
> pretty rounded corners. PS: this is the kind of thing which is
> typically done when making css tabbed menus.
>
> My html looks like this:
>
> <div class="Button" id="btnReset"><a class="aButton"
> href="javascript:Clear();" title="Refresh"><span
> class="sButton">Refresh</span></a></div>
>
> The button displays fine and the two images look like a seamless
> whole. The point of this being that I can use any word apart from
> "Refresh" and the images will size themselves in the background to
> wrap the text nicely. The <a> element has the LHS part of the button
> and the sButton class references the RHS of the button.
>
> How do I fire a server side event from that "javascript:Clear();"?
>
> There is a matching button to this as well with a
> href="javascript:Search();"
>
> I have thought of storing a suitable value in a hidden form variable.
> Can I then submit the asp.net form from javascript?, and then select
> the server-side to execute depending on the value of the form variable
> (seems a pretty ugly way of doing things to me). What is the 'correct'
> way of doing this?
>
> I have no intention of making a user control as it would be more
> productive to ajaxify the page but, right now, I prefer something
> quick.
>

 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Linkbutton does not look like a linkbutton Sathyaish ASP .Net 3 09-08-2005 09:41 AM
Linkbutton does not look like a linkbutton Sathyaish ASP .Net Datagrid Control 1 09-08-2005 08:44 AM
How to emulate Word mail merge in HTML? VB Programmer ASP .Net 2 05-20-2004 04:32 PM
Emulate PIX Firewall shaulbe Cisco 19 04-15-2004 06:54 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