473,804 Members | 2,711 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Custom control with button inside, how to integrate OnClick? - ASP.NET

2 New Member
Hi there,

i'm trying to accomplish the following (however searching the net for days now, without result):

As you know you have a asp button:
<asp:Button ID="test" Text="Test" OnClick="Test_B utton_Click">

this will launch the method "Test_Button_Cl ick" on the server side. As i find the built in OS buttons ugly, i designed some new buttons myself, and it uses a table of 3 columns wide, and 1 row high. in the middle is a transparent button, only showing the text. In the left and right there are some images as background with some roundings (to make a smooth nice looking button).

The probem now is that i want to do the following:
<uc1:UserButt on ID="Test" Text="Test" OnClick="Test_B utton_Click">

but i can't get the OnClick attribute to work for the usercontrol, tried few different things that i found on the internet, and eventually it leaded me to launch javascript. So to sum it up: I have a asp button in the usercontrol, but i want to be able to pass the OnClick attribute of the usercontrol to the button. I searched for days now. If anyone can help me, please. Thanks in advance!

Kind Regards,
Nick
Apr 1 '08 #1
1 1307
Nick Verlinden
2 New Member
Never mind, I solved it!




Hi there,

i'm trying to accomplish the following (however searching the net for days now, without result):

As you know you have a asp button:
<asp:Button ID="test" Text="Test" OnClick="Test_B utton_Click">

this will launch the method "Test_Button_Cl ick" on the server side. As i find the built in OS buttons ugly, i designed some new buttons myself, and it uses a table of 3 columns wide, and 1 row high. in the middle is a transparent button, only showing the text. In the left and right there are some images as background with some roundings (to make a smooth nice looking button).

The probem now is that i want to do the following:
<uc1:UserButt on ID="Test" Text="Test" OnClick="Test_B utton_Click">

but i can't get the OnClick attribute to work for the usercontrol, tried few different things that i found on the internet, and eventually it leaded me to launch javascript. So to sum it up: I have a asp button in the usercontrol, but i want to be able to pass the OnClick attribute of the usercontrol to the button. I searched for days now. If anyone can help me, please. Thanks in advance!

Kind Regards,
Nick
Apr 2 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3922
by: Pham Nguyen | last post by:
Has anyone seen an example of a textbox server control that has built-in client-side validation? I'd like to build a server control that extends the System.Web.UI.WebControls.TextBox class to allow javascript checks for things like valid e-mail addresses or phone numbers (without having to add a separate control for validation). One idea I did some work on was having the control implement the IValidator interface and basically recreating...
2
4298
by: KarlCharlotteNc | last post by:
I have a custom server control that renders a Submit button. The button renders just fine at design and run time. The button click event is being trapped normally. My problem : If I add a textbox and a required field validator, my button does not cause either the normal client or server side validation to occur. Is there a method I must call or an interface I must implement to get my custom control wired up on the Page like a normal...
19
4922
by: Jamey Shuemaker | last post by:
I'm in the process of expanding my knowledge and use of Class Modules. I've perused MSDN and this and other sites, and I'm pretty comfortable with my understanding of Class Modules with the exception of custom Collection Classes. Background: I'm developing an A2K .mdb to be deployed as an .mde at my current job-site. It has several custom controls which utilize custom classes to wrap built-in controls, and add additional functionality....
6
6684
by: John Smith | last post by:
How can I find out which control performed PostBack? I have put this code inside my Page_Load event: Response.Write(Page.Request.Params.Get("__EVENTTARGET")) but it doesn't write to response anything when I click on the button inside DataGrid (my asp:Button is located inside my template column togrther with my asp:TextBox). It works fine for DropDownList, which is also inside template column inside DataGrid.
6
3524
by: Budhi Saputra Prasetya | last post by:
Hi All, I'm trying to display .NET Custom Control (created using Inherited Control) on an ASPX page, but no luck. I already registered the Control to Global Assembly Cache through .NET Framework 1.1 Configuration. I have also put a reference to the control on my ASP .NET project. The view that I get is only a disabled text area. Below is the code that I'm using:
1
4818
by: rn5a | last post by:
I have created a custom control button which when clicked displays a message in the JavaScript alert dialog. I could successfully compile the VB class file into a DLL & also could add it to the Toolbox in Visual Web Developer 2005 Express Edition but the alert message isn't popping up when I am implementing this control in an ASP.NET page & clicking the Button in the ASPX page. This is the class file: Imports System Imports System.Web...
1
3232
by: rn5a | last post by:
I want to create a custom control that encapsulates a Button & a TextBox. When the Button is clicked, the user is asked a question using JavaScript confirm (which shows 2 buttons - 'OK' & 'Cancel'). Till this point, no problem. Initially, the TextBox is empty. The Button has a property named 'ConfirmMessage' so that the developer using this custom control can modify the question in the confirm dialog. If the user clicks 'OK', I want the...
0
1395
by: rn5a | last post by:
A custom control is derived from the WebControl class & encapsulates a TextBox & a Button. When the Button is clicked, the user is shown the JavaScript confirm dialog with the 'OK' & 'Cancel' buttons. If the user clicks 'OK', the TextBox gets populated with 'true' & if 'Cancel' is clicked, the TextBox gets populated with 'false'. Note that when the user first comes to the ASPX page that uses this custom control, the TextBox is empty. This...
0
1906
by: OceanBreeze | last post by:
I have added a LinkButton to a table cell programmatically inside the Page_Load method. I also added a custom event to that link button. The same custom event is valid for all the link buttons. The table gets successfully displayed on the browser with the LinkButton. When I click on the link button in the browser, my control does not go inside the custom even that I wrote for the link button. I have a table control as ProviderTbl in which...
0
9704
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9571
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10318
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10302
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5505
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2976
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.