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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nick Verlinden
    New Member
    • Apr 2008
    • 2

    #1

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

    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
    Last edited by jhardman; Apr 1 '08, 11:26 PM. Reason: moved to .Net forum. ASP forum is for "classic" ASP
  • Nick Verlinden
    New Member
    • Apr 2008
    • 2

    #2
    Never mind, I solved it!




    Originally posted by Nick Verlinden
    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

    Comment

    Working...