Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Asp Function and OnClick propertiy

I'm using Visual Studio to create a asp website. The problem im having is i can't get the onclick to work.
I want to create a function/method/ subroutine, and when the button is pressed i can't the code in the function to be called.

I have:

[code]
<% Languague=VBScript%>

<%
Sub Button_Click(Src As Object, Args As EventArgs)
Response.Write("blah")
End Sub
%>
'then i have a table with a button in it


[/code]
That doesn't work,
I have also tried

[code]
<%
Sub Search
Response.Write ("dfsdf")
End Sub
%>
'calling it
">

[/code]

Anyone got any ideas?
Thanks in advance
*Ribbleton_

Comments

  • aaronjones3593aaronjones3593 Posts: 122Member
    [b][red]This message was edited by aaronjones3593 at 2006-3-5 18:43:58[/red][/b][hr]
    : I'm using Visual Studio to create a asp website. The problem im having is i can't get the onclick to work.
    : I want to create a function/method/ subroutine, and when the button is pressed i can't the code in the function to be called.
    :
    : I have:
    :
    : [code]
    : <% Languague=VBScript%>
    :
    : <%
    : Sub Button_Click(Src As Object, Args As EventArgs)
    : Response.Write("blah")
    : End Sub
    : %>
    : 'then i have a table with a button in it
    :
    :
    : [/code]
    : That doesn't work,
    : I have also tried
    :
    : [code]
    : <%
    : Sub Search
    : Response.Write ("dfsdf")
    : End Sub
    : %>
    : 'calling it
    : ">
    :
    : [/code]
    :
    : Anyone got any ideas?
    : Thanks in advance
    : *Ribbleton_
    :
    :

    2 things I see straight away that are wrong with that (Although, I'm not sure about one):

    [code]
    <% Languag[red]u[/red]e=VBScript%>
    [/code]

    [code]
    [red]<%[/red]
    Sub Button_Click(Src As Object, Args As EventArgs)
    Response.Write("blah")
    End Sub
    [red]%>[/red]
    [/code]

    The first thing is DEFINITELY wrong. Look at it closely.

    The second thing; I'm not sure about this, but since ASP is server-side and HTML is client-side, HTML shouldnt be able to call an ASP function should it?

    Try this:

    [code]

    Sub Button_Click()
    Document.Write("blah")
    End Sub


    [/code]

    Also, you can't have <% %> (ASP) in an OnClick="" event handler. They're two different things; HTML and ASP. OnClick CAN'T call ASP code.


    -( Aaron )-

    "Alcohol aint the answer, but atleast you forget the question"



  • RibbletonRibbleton Posts: 152Member
    : [b][red]This message was edited by aaronjones3593 at 2006-3-5 18:43:58[/red][/b][hr]
    : : I'm using Visual Studio to create a asp website. The problem im having is i can't get the onclick to work.
    : : I want to create a function/method/ subroutine, and when the button is pressed i can't the code in the function to be called.
    : :
    : : I have:
    : :
    : : [code]
    : : <% Languague=VBScript%>
    : :
    : : <%
    : : Sub Button_Click(Src As Object, Args As EventArgs)
    : : Response.Write("blah")
    : : End Sub
    : : %>
    : : 'then i have a table with a button in it
    : :
    : :
    : : [/code]
    : : That doesn't work,
    : : I have also tried
    : :
    : : [code]
    : : <%
    : : Sub Search
    : : Response.Write ("dfsdf")
    : : End Sub
    : : %>
    : : 'calling it
    : : ">
    : :
    : : [/code]
    : :
    : : Anyone got any ideas?
    : : Thanks in advance
    : : *Ribbleton_
    : :
    : :
    :
    : 2 things I see straight away that are wrong with that (Although, I'm not sure about one):
    :
    : [code]
    : <% Languag[red]u[/red]e=VBScript%>
    : [/code]
    :
    : [code]
    : [red]<%[/red]
    : Sub Button_Click(Src As Object, Args As EventArgs)
    : Response.Write("blah")
    : End Sub
    : [red]%>[/red]
    : [/code]
    :
    : The first thing is DEFINITELY wrong. Look at it closely.
    :
    : The second thing; I'm not sure about this, but since ASP is server-side and HTML is client-side, HTML shouldnt be able to call an ASP function should it?
    :
    : Try this:
    :
    : [code]
    :
    : Sub Button_Click()
    : Document.Write("blah")
    : End Sub
    :
    :
    : [/code]
    :
    : Also, you can't have <% %> (ASP) in an OnClick="" event handler. They're two different things; HTML and ASP. OnClick CAN'T call ASP code.
    :
    :
    : -( Aaron )-
    :
    : "Alcohol aint the answer, but atleast you forget the question"
    :
    :
    :

    It didn't work, no OnClick property within the ""
    all I want is to have a button, when i press it i call some ASP code which will search a access database depending on the input. Anyone got any examples? If you create ASP page in Visual studio you have three options for buttons

    1,

    2,

    3,


    Would it be easiler to use maybe a submit button, i really have no idea!

    Thanks in advance,

    *Ribbleton_


  • shraddha1904shraddha1904 Posts: 2Member
    try this.....

    onclick="Javascript:call_Click()"

    provided u've written the code using javascript...becoz it is working for me....

Sign In or Register to comment.