Disabling AutoPostBack on Button.Click() to activate Javascriptfunction

Discussion in 'ASP .Net' started by maximz2005, Dec 13, 2008.

  1. maximz2005

    maximz2005 Guest


    I'm currently writing an ASP.NET application for a demonstration with
    hydrological web services.
    I'm having a problem: I obtain a certain latitude and longitude for a
    point via web services in C#, and then, I need to pass those variables
    to a javascript function that draws a marker on a map for me.
    When I press the button to obtain the latitude and longitude and draw
    a marker, the page postbacks and refreshes, so the marker isn't drawn.

    I'm using Page.RegisterClientScriptBlock(...) to activate the
    Javascript function I have called AddMarker(lon, lat) .

    I've tried disabling EnableViewState for the form my button is in and
    the button itself, but it doesn't help. How can I accomplish this?

    Thank you so much!
    maximz2005, Dec 13, 2008
    1. Advertisements

  2. maximz2005

    maximz2005 Guest

    I think I solved the problem - I transformed the ASP:button into an
    HTML button, which gets C# values through Javascript.

    Thank you
    maximz2005, Dec 13, 2008
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.