当 gridview 的选择发生变化时,我有一个问题,我想调用 javascript 代码。但是,我无法启动我的 javascript。我怎样才能做到这一点?
//HTML端
<input ID="addressinput" type="text" runat="server" style="display:none;"/>
<asp:Button ID="Button1" runat="server" Text="Button" style="display:none;" OnClientClick="return myfunction();" onclick="Button1_Click" />
//Javascript
function myfunction() {
FindLocaiton();
}
//C#
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
addressinput.Value = GridView1.SelectedRow.Cells[1].Text;
Button1.Click += new EventHandler(Button1_Click);
}
protected void Button1_Click(object sender, EventArgs e)
{
}