Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Need button control that...

Reply
Thread Tools

Need button control that...

 
 
David Thielen
Guest
Posts: n/a
 
      10-21-2006
I need a button control that does the following:

1) Has 3 bitmaps for button, OnHover, and OnClick.
2) Is placed in a grid and has a url that includes a {0} in the url that is
set with a property from the data for that row of the grid.
3) Preferably has a text (for when the cursor is over it) that has a {0}
that is another property for that row's data.

I'm sure this can be done with the MS controls - but I can't find which/how.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm


 
Reply With Quote
 
 
 
 
David Thielen
Guest
Posts: n/a
 
      10-22-2006
Hi again;

And in some cases I need an OnClick that calls confirm to ask the user if
they are sure they want to perform that action.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm




"David Thielen" wrote:

> I need a button control that does the following:
>
> 1) Has 3 bitmaps for button, OnHover, and OnClick.
> 2) Is placed in a grid and has a url that includes a {0} in the url that is
> set with a property from the data for that row of the grid.
> 3) Preferably has a text (for when the cursor is over it) that has a {0}
> that is another property for that row's data.
>
> I'm sure this can be done with the MS controls - but I can't find which/how.
>
> --
> thanks - dave
> david_at_windward_dot_net
> http://www.windwardreports.com
>
> Cubicle Wars - http://www.windwardreports.com/film.htm
>
>

 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      10-23-2006
Hello Dave,

As for the Button control you mentioned, I think you may have two possible
options:

1. Use existing built-in server control and add some additional
customization on it. According to your requirments, I think the LinkButton
or HyperLink control will be prefered one.

2. Create a custom button control and add those functionality in it.

regardless of which approach you use, here are the suggestion on how you
can implement those requirements in the control:


** Has 3 bitmaps for button, OnHover, and OnClick.
=====================
for display different images for different status, you can consider use
java script to change the html element's background image property or
change different css class which has configured the image background.
Those script event like "onhover" is the correct one.


** Is placed in a grid and has a url that includes a {0} in the url that is
set with a property from the data for that row of the grid.
=============================
this could be done through databinding on the hyperlink's Url property


**Preferably has a text (for when the cursor is over it) that has a {0}
that is another property for that row's data.
===============================
This can be done through databinding on Hyperlink control' "ToolTip"
property.

#WebControl.ToolTip Property
http://msdn2.microsoft.com/en-us/lib...rols.webcontro
l.tooltip.aspx


**And in some cases I need an OnClick that calls confirm to ask the user if
they are sure they want to perform that action.
==================================
This is also a javascript based solution, there are many web article
describing this detailedly:

#ASP.NET Popup Dialog - Confirm Delete - Javascript
http://davidhayden.com/blog/dave/arc...03/16/178.aspx

#How to Confirm a Delete in an ASP.NET Datagrid...
http://www.dotnetjohn.com/articles.aspx?articleid=68

Please feel free to let me know if you have anything unclear.

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
 
David Thielen
Guest
Posts: n/a
 
      10-24-2006
Hi;

I am getting most of this but I can't figure out how to get an onmouseover
on the inner <img> of a <asp:HyperLink> - it always is set for the HyperLink
<a href...> tag.

I'm thinking this might be a lot better to implement as a control anyways as
it is always a DataField that I am using it for and then I eleminate the
<TemplateField>... part.

Do you know of a good example of a control like HyperLinkField that has
source code available?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm




"Steven Cheng[MSFT]" wrote:

> Hello Dave,
>
> As for the Button control you mentioned, I think you may have two possible
> options:
>
> 1. Use existing built-in server control and add some additional
> customization on it. According to your requirments, I think the LinkButton
> or HyperLink control will be prefered one.
>
> 2. Create a custom button control and add those functionality in it.
>
> regardless of which approach you use, here are the suggestion on how you
> can implement those requirements in the control:
>
>
> ** Has 3 bitmaps for button, OnHover, and OnClick.
> =====================
> for display different images for different status, you can consider use
> java script to change the html element's background image property or
> change different css class which has configured the image background.
> Those script event like "onhover" is the correct one.
>
>
> ** Is placed in a grid and has a url that includes a {0} in the url that is
> set with a property from the data for that row of the grid.
> =============================
> this could be done through databinding on the hyperlink's Url property
>
>
> **Preferably has a text (for when the cursor is over it) that has a {0}
> that is another property for that row's data.
> ===============================
> This can be done through databinding on Hyperlink control' "ToolTip"
> property.
>
> #WebControl.ToolTip Property
> http://msdn2.microsoft.com/en-us/lib...rols.webcontro
> l.tooltip.aspx
>
>
> **And in some cases I need an OnClick that calls confirm to ask the user if
> they are sure they want to perform that action.
> ==================================
> This is also a javascript based solution, there are many web article
> describing this detailedly:
>
> #ASP.NET Popup Dialog - Confirm Delete - Javascript
> http://davidhayden.com/blog/dave/arc...03/16/178.aspx
>
> #How to Confirm a Delete in an ASP.NET Datagrid...
> http://www.dotnetjohn.com/articles.aspx?articleid=68
>
> Please feel free to let me know if you have anything unclear.
>
> 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
 
alvinzc@gmail.com
Guest
Posts: n/a
 
      10-24-2006
Hi, you can have something like this in your code-behind,

HyperLink1.Attributes.Add("onmouseover",
"this.childNodes[0].src='images/myimage.gif'");

To see the code of HyperField class, you can check
http://www.koders.com/csharp/fidA492...alidationValue,
though it is mono version.



Regards,
Alvin Chooi
Microsoft ASP.NET Enthusiast
http://alvinzc.blogspot.com

 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      10-24-2006
Hello Dave,

Thanks for the reply,

Yes, if you directly use the built-in Hyperlink control, it may be a bit
hard to add Image in it ,and hyperlink (<a>) can only support a background
image. If you want to purely display an Image, you can completely render
out the following like html in your custom control. e.g

========================
<a id="a1" href="controlpage2.aspx" ><img id="imgLink"
src="http://www.asp.net/i/www_asp_net_logo.gif" /> </a>
===========

Or you can even do not use <a> , but only use <img> element and use
client-script to simulate hyperlink's redirect functionality. e.g

<img id="imgLink" src="http://www.asp.net/i/www_asp_net_logo.gif"
onclick="window.location.herf=newurl;" />

So far I haven't got any other existing control sample, you can have a
look at ASP.NET site's control gallery or in codeproject:

http://www.asp.net/default.aspx?tabindex=6&tabid=31

Also, you can use reflector tool to inspect the built-in hyperlink control
or image button control's code which can also provide much ideas on this.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


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

 
Reply With Quote
 
David Thielen
Guest
Posts: n/a
 
 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      10-25-2006
Good job Dave,

Thanks for sharing them with us!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


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
Need to dynamically add <ASP:Button> controls to web user control w.in page FredZimmerman@gmail.com ASP .Net 1 09-02-2007 08:06 PM
How to set a button from a user control the default button on an aspx page AlecL ASP .Net 2 02-12-2007 09:15 PM
Responding to Button control events when Button is added to a Table Control Jim Gilligan ASP .Net Web Controls 0 09-01-2005 06:29 PM
image button click event fires before click event of button Purvi T ASP .Net 0 10-19-2004 06:19 AM
JavaScript Access to Button in form tags (webcontrol or html button) Wes Weems ASP .Net 1 07-20-2003 05:27 AM



Advertisments