Results 1 to 3 of 3

Thread: One Button - JavaScript and VB.NET?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618

    One Button - JavaScript and VB.NET?

    Is it possible to make a single button run a client side script and run a server side function? If so how? Thanks.
    Sean

    Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.

  2. #2
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497

    Re: One Button - JavaScript and VB.NET?

    Add a server side control, then at the Page_Load for your page, add a property to the button for name=onClick and parameter="Your function"

    The compiler will add it and then add its own definition for the click handler too. If your client function returns a true value, the post back occurs and the server side executes.

    If your client code returns false, execution halts and the button does not post back.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: One Button - JavaScript and VB.NET?

    Also possible if you do this in page load:

    Button1.Attributes.Add("onClick", "functionCall();");

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width