admin管理员组文章数量:1389750
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)
本文标签: javascriptHow to pass 2 parameters through RegisterStartupScriptStack Overflow
版权声明:本文标题:javascript - How to pass 2 parameters through RegisterStartupScript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744741991a2622662.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论