Call Javascript function from Gridview RowDeleting event
I need to call a javascript alert from an if开发者_如何学Go condition inside a gridview in the gvLocations_RowDeleting section.
Code is as follows:
protected void gvLocations_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
if (CheckIfLocationExists(ID) == true)
{
//need to call javascript function sendmessage() here??
}
}
I have a javascript function in the .aspx file as follows
<script type="text/javascript">
function sendmessage()
{
alert("Area is associated with this location already");
}
</script>
I know this is an easy move but for some reason Im having trouble. Can someone help? thanks in advance. Stack Overflow rocks!
Actually I figured it out. Hopefully this will help someone else..Use the code below, works like a charm..
Page.ClientScript.RegisterStartupScript(this.GetType(), "helloworldpopup", "alert('hello world');", true);
精彩评论