|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Need button control that...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 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. -- Show quoteHide quotethanks - 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 > > 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/library/system.web.ui.webcontrols.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/archive/2004/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/subscriptions/managednewsgroups/default.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/subscriptions/support/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. 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? -- Show quoteHide quotethanks - 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/library/system.web.ui.webcontrols.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/archive/2004/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/subscriptions/managednewsgroups/default.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/subscriptions/support/default.aspx. > > ================================================== > > > > This posting is provided "AS IS" with no warranties, and confers no rights. > > > > > > > > > > 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. Solutions at:
http://www.davidthielen.info/programming/2006/10/buttonlinkfield.html and http://www.davidthielen.info/programming/2006/10/linkimagebutton.html -- thanks - dave david_at_windward_dot_net http://www.windwardreports.com Cubicle Wars - http://www.windwardreports.com/film.htm 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. 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/fidA49285925F7356D2BB86793725916198217B8291.aspx?s=GetControlValidationValue, though it is mono version. Regards, Alvin Chooi Microsoft ASP.NET Enthusiast http://alvinzc.blogspot.com
auto-size textbox
Display an empty grid good sample of creating my own web control? menu question all bitmap button in grid? how to validate input of a detailsview? Datagrid template column GridView RowComand event Issue Textbox - inserted enters how to make programmatically a field of detailsview read-only ? |
|||||||||||||||||||||||