I have a javascript function "initialize (latitude, longitude)" and when I click on my button I want to pass the value from my textbox to do something.
Protected Sub btnLat_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim latit As TextBox = formView.FindControl("nr_latitudeTextBox")
Dim longit As TextBox = formView.FindControl("nr_longitudeTextBox")
Page.ClientScript.RegisterStartupScript(Me.GetType(), "initialize", "initialize(" & latit.Text, longit.Text & ");", True)
End Sub
But when I try to do this I get the error
Overload resolution failed because no accessible "RegisterStartupScript" accepts this number of arguments.
I have a javascript function "initialize (latitude, longitude)" and when I click on my button I want to pass the value from my textbox to do something.
Protected Sub btnLat_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim latit As TextBox = formView.FindControl("nr_latitudeTextBox")
Dim longit As TextBox = formView.FindControl("nr_longitudeTextBox")
Page.ClientScript.RegisterStartupScript(Me.GetType(), "initialize", "initialize(" & latit.Text, longit.Text & ");", True)
End Sub
But when I try to do this I get the error
Share Improve this question edited Jun 5, 2019 at 18:09 TylerH 21.1k79 gold badges79 silver badges114 bronze badges asked May 14, 2013 at 12:50 migmigmigmig 1413 gold badges6 silver badges16 bronze badges 1Overload resolution failed because no accessible "RegisterStartupScript" accepts this number of arguments.
- check this sample codeproject./Articles/11098/… – Akshay Joy Commented May 14, 2013 at 12:55
1 Answer
Reset to default 3You have just implemented the code wrongly. Change it to.
If your initialize
function expects string variables then use the 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)
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744741992a4591081.html
评论列表(0条)