javascript - How to pass 2 parameters through RegisterStartupScript? -
i have javascript function "initialize (latitude, longitude)" , when click on button want pass value textbox something.
protected sub btnlat_click(byval sender object, byval e system.eventargs) dim latit textbox = formview.findcontrol("nr_latitudetextbox") dim longit textbox = formview.findcontrol("nr_longitudetextbox") page.clientscript.registerstartupscript(me.gettype(), "initialize", "initialize(" & latit.text, longit.text & ");", true)
end sub
but when try e error
overload resolution failed because no accessible "registerstartupscript" accepts number of arguments.
you have implemented code wrongly. change to.
if initialize
function expects string variables use code;
page.clientscript.registerstartupscript(me.gettype(), "initialize", "initialize('" & latit.text & "','" & longit.text & "');", true)
if initialize
expects integers then;
page.clientscript.registerstartupscript(me.gettype(), "initialize", "initialize(" & latit.text & "," & longit.text & ");", true)
Comments
Post a Comment